Added basic utilities.
This commit is contained in:
parent
f55f4d699d
commit
84475594cc
8 changed files with 113 additions and 19 deletions
12
modules/rhizomatica_base_system/files/bin/bind_check.sh
Executable file
12
modules/rhizomatica_base_system/files/bin/bind_check.sh
Executable file
|
@ -0,0 +1,12 @@
|
||||||
|
#!/bin/bash
|
||||||
|
|
||||||
|
currdate=`date`
|
||||||
|
|
||||||
|
if (grep 'but not bound for Rx' /var/log/osmo-nitb/current > /dev/null); then
|
||||||
|
echo -e "$currdate - OpenBSC lost RX bind" >> /var/log/bind_check.log
|
||||||
|
/etc/init.d/kannel restart >/dev/null
|
||||||
|
:>/var/log/osmo-nitb/current
|
||||||
|
echo -e "$currdate - Restarted kannel and cleared osmo-nitb log" >> /var/log/bind_check.log
|
||||||
|
else
|
||||||
|
echo -e "$currdate - OpenBSC has the RX bind" >> /var/log/bind_check.log
|
||||||
|
fi
|
10
modules/rhizomatica_base_system/files/bin/capture_traffic.sh
Executable file
10
modules/rhizomatica_base_system/files/bin/capture_traffic.sh
Executable file
|
@ -0,0 +1,10 @@
|
||||||
|
#!/bin/bash -x
|
||||||
|
TCPDUMP="/usr/sbin/tcpdump"
|
||||||
|
CAPTURE_DEVICE="eth1"
|
||||||
|
CAPTURE_PORTS="port 3002 or port 3003"
|
||||||
|
CAPTURE_LIMIT="1024"
|
||||||
|
CAPTURE_SIZE="1"
|
||||||
|
CAPTURE_BASENAME="/tmp/tcpdump-capture-"
|
||||||
|
CAPTURE_COMPRESS="-z /usr/sbin/tcpdump-compress"
|
||||||
|
CAPTURE_OPTIONS="-pi $CAPTURE_DEVICE -s0 -w $CAPTURE_BASENAME -C $CAPTURE_SIZE -W $CAPTURE_LIMIT $CAPTURE_COMPRESS $CAPTURE_PORTS"
|
||||||
|
$TCPDUMP $CAPTURE_OPTIONS
|
4
modules/rhizomatica_base_system/files/bin/check_amp_status.sh
Executable file
4
modules/rhizomatica_base_system/files/bin/check_amp_status.sh
Executable file
|
@ -0,0 +1,4 @@
|
||||||
|
#!/bin/sh
|
||||||
|
. ./vars.sh
|
||||||
|
echo "BTS1: "
|
||||||
|
ssh root@$BTS1 sbts2050-util sbts2050-pwr-status | grep Amp
|
4
modules/rhizomatica_base_system/files/bin/check_status.sh
Executable file
4
modules/rhizomatica_base_system/files/bin/check_status.sh
Executable file
|
@ -0,0 +1,4 @@
|
||||||
|
#!/bin/sh
|
||||||
|
. ./vars.sh
|
||||||
|
echo "BTS1: "
|
||||||
|
ssh root@$BTS1 sbts2050-util sbts2050-pwr-status
|
13
modules/rhizomatica_base_system/files/bin/log_broken_channels.sh
Executable file
13
modules/rhizomatica_base_system/files/bin/log_broken_channels.sh
Executable file
|
@ -0,0 +1,13 @@
|
||||||
|
#!/bin/bash
|
||||||
|
. ./vars.sh
|
||||||
|
|
||||||
|
while (true);
|
||||||
|
do STR=`echo "show lchan" | nc localhost 4242 | grep BROKEN`;
|
||||||
|
|
||||||
|
if [ -n "$STR" ];
|
||||||
|
then echo `date "+%y%m%d_%H%M"` >> /var/tmp/broken_channels_log.txt;
|
||||||
|
STR=`echo "show lchan" | nc localhost 4242`;
|
||||||
|
echo -e "Subject:BROKEN Channels\n\nBroken at: `date`\n\n\n$STR" | sendmail $RECIPIENTS
|
||||||
|
fi;
|
||||||
|
sleep 600;
|
||||||
|
done
|
34
modules/rhizomatica_base_system/files/bin/turn_on_amplifier.sh
Executable file
34
modules/rhizomatica_base_system/files/bin/turn_on_amplifier.sh
Executable file
|
@ -0,0 +1,34 @@
|
||||||
|
#!/bin/bash
|
||||||
|
. ./vars.sh
|
||||||
|
|
||||||
|
echo "Beginning amplifier procedure... brace yourself!"
|
||||||
|
|
||||||
|
echo "turning off osmo-nitb and kannel"
|
||||||
|
sv stop osmo-nitb
|
||||||
|
/etc/init.d/kannel stop
|
||||||
|
|
||||||
|
echo "Rebooting first BTS"
|
||||||
|
ssh root@$BTS1 "/sbin/reboot"
|
||||||
|
|
||||||
|
echo "sleeping 30 seconds..."
|
||||||
|
sleep 30
|
||||||
|
|
||||||
|
echo "turning off the second BTS"
|
||||||
|
ssh root@$BTS1 "/usr/bin/sbts2050-util sbts2050-pwr-enable 1 0 0"
|
||||||
|
|
||||||
|
echo "sleeping 10 seconds..."
|
||||||
|
sleep 10
|
||||||
|
|
||||||
|
echo "turning on the amplifier"
|
||||||
|
ssh root@$BTS1 "/usr/bin/sbts2050-util sbts2050-pwr-enable 1 0 1"
|
||||||
|
|
||||||
|
echo "sleeping 10 seconds..."
|
||||||
|
sleep 10
|
||||||
|
|
||||||
|
echo "turning back on the second BTS"
|
||||||
|
ssh root@$BTS1 "/usr/bin/sbts2050-util sbts2050-pwr-enable 1 1 1"
|
||||||
|
|
||||||
|
echo "turning on osmo-nitb and kannel"
|
||||||
|
sv start osmo-nitb
|
||||||
|
sleep 10
|
||||||
|
/etc/init.d/kannel start
|
|
@ -13,19 +13,33 @@
|
||||||
class rhizomatica_base_system {
|
class rhizomatica_base_system {
|
||||||
|
|
||||||
$vpn_address = hiera('rhizo::vpn_address')
|
$vpn_address = hiera('rhizo::vpn_address')
|
||||||
|
$bts1_address = hiera('rhizo::bts1_address')
|
||||||
|
$mail_admins = hiera('rhizo::mail_admins')
|
||||||
$postgresql_password = hiera('rhizo::postgresql_password')
|
$postgresql_password = hiera('rhizo::postgresql_password')
|
||||||
$smsc_password= hiera('rhizo::smsc_password')
|
$smsc_password = hiera('rhizo::smsc_password')
|
||||||
$kannel_admin_password = ('rhizo::kannel_admin_password')
|
$kannel_admin_password = hiera('rhizo::kannel_admin_password')
|
||||||
$kannel_sendsms_password = hiera('rhizo::kannel_sendsms_password')
|
$kannel_sendsms_password = hiera('rhizo::kannel_sendsms_password')
|
||||||
|
|
||||||
include 'ntp'
|
include ntp
|
||||||
include 'kannel'
|
include kannel
|
||||||
|
|
||||||
file { '/etc/apt/apt.conf.d/90unsigned':
|
file { '/etc/apt/apt.conf.d/90unsigned':
|
||||||
ensure => present,
|
ensure => present,
|
||||||
content => 'APT::Get::AllowUnauthenticated "true";',
|
content => 'APT::Get::AllowUnauthenticated "true";',
|
||||||
}
|
}
|
||||||
|
|
||||||
|
file { '/home/rhizomatica/bin':
|
||||||
|
ensure => directory,
|
||||||
|
source => 'puppet:///modules/rhizomatica_base_system/bin',
|
||||||
|
recurse => true,
|
||||||
|
purge => false,
|
||||||
|
}
|
||||||
|
|
||||||
|
file { '/home/rhizomatica/bin/vars.sh':
|
||||||
|
ensure => present,
|
||||||
|
content => template('rhizomatica_base_system/vars.sh.erb'),
|
||||||
|
}
|
||||||
|
|
||||||
class { 'apt': }
|
class { 'apt': }
|
||||||
|
|
||||||
apt::source { 'rhizomatica':
|
apt::source { 'rhizomatica':
|
||||||
|
@ -73,26 +87,26 @@ class rhizomatica_base_system {
|
||||||
|
|
||||||
file { '/etc/sv':
|
file { '/etc/sv':
|
||||||
ensure => directory,
|
ensure => directory,
|
||||||
source => "puppet:///modules/rhizomatica_base_system/etc/sv",
|
source => 'puppet:///modules/rhizomatica_base_system/etc/sv',
|
||||||
recurse => true,
|
recurse => true,
|
||||||
require => Package['runit'],
|
require => Package['runit'],
|
||||||
}
|
}
|
||||||
|
|
||||||
file { '/etc/service/osmo-nitb':
|
file { '/etc/service/osmo-nitb':
|
||||||
ensure => link,
|
ensure => link,
|
||||||
target => "/etc/sv/osmo-nitb",
|
target => '/etc/sv/osmo-nitb',
|
||||||
require => File['/etc/sv'],
|
require => [ File['/etc/sv'], Package['osmocom-nitb'] ],
|
||||||
}
|
}
|
||||||
|
|
||||||
file { '/etc/service/freeswitch':
|
file { '/etc/service/freeswitch':
|
||||||
ensure => link,
|
ensure => link,
|
||||||
target => "/etc/sv/freeswitch",
|
target => '/etc/sv/freeswitch',
|
||||||
require => File['/etc/sv'],
|
require => [ File['/etc/sv'], Package['freeswitch'] ],
|
||||||
}
|
}
|
||||||
|
|
||||||
file { '/etc/service/rapi':
|
file { '/etc/service/rapi':
|
||||||
ensure => link,
|
ensure => link,
|
||||||
target => "/etc/sv/rapi",
|
target => '/etc/sv/rapi',
|
||||||
require => File['/etc/sv'],
|
require => File['/etc/sv'],
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -143,4 +157,4 @@ file { '/etc/service/rapi':
|
||||||
require => Apt::Source['rhizomatica'],
|
require => Apt::Source['rhizomatica'],
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
3
modules/rhizomatica_base_system/templates/vars.sh.erb
Normal file
3
modules/rhizomatica_base_system/templates/vars.sh.erb
Normal file
|
@ -0,0 +1,3 @@
|
||||||
|
#!/bin/sh
|
||||||
|
BTS1=<%= @bts1_address %>
|
||||||
|
RECIPIENTS=<%= @mail_admins %>
|
Loading…
Add table
Add a link
Reference in a new issue