Added basic utilities.

This commit is contained in:
Ciaby 2014-07-14 14:23:00 -05:00
parent f55f4d699d
commit 84475594cc
8 changed files with 113 additions and 19 deletions

View 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

View 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

View file

@ -0,0 +1,4 @@
#!/bin/sh
. ./vars.sh
echo "BTS1: "
ssh root@$BTS1 sbts2050-util sbts2050-pwr-status | grep Amp

View file

@ -0,0 +1,4 @@
#!/bin/sh
. ./vars.sh
echo "BTS1: "
ssh root@$BTS1 sbts2050-util sbts2050-pwr-status

View 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

View 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

View file

@ -13,19 +13,33 @@
class rhizomatica_base_system {
$vpn_address = hiera('rhizo::vpn_address')
$bts1_address = hiera('rhizo::bts1_address')
$mail_admins = hiera('rhizo::mail_admins')
$postgresql_password = hiera('rhizo::postgresql_password')
$smsc_password= hiera('rhizo::smsc_password')
$kannel_admin_password = ('rhizo::kannel_admin_password')
$smsc_password = hiera('rhizo::smsc_password')
$kannel_admin_password = hiera('rhizo::kannel_admin_password')
$kannel_sendsms_password = hiera('rhizo::kannel_sendsms_password')
include 'ntp'
include 'kannel'
include ntp
include kannel
file { '/etc/apt/apt.conf.d/90unsigned':
ensure => present,
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': }
apt::source { 'rhizomatica':
@ -73,26 +87,26 @@ class rhizomatica_base_system {
file { '/etc/sv':
ensure => directory,
source => "puppet:///modules/rhizomatica_base_system/etc/sv",
source => 'puppet:///modules/rhizomatica_base_system/etc/sv',
recurse => true,
require => Package['runit'],
}
file { '/etc/service/osmo-nitb':
ensure => link,
target => "/etc/sv/osmo-nitb",
require => File['/etc/sv'],
target => '/etc/sv/osmo-nitb',
require => [ File['/etc/sv'], Package['osmocom-nitb'] ],
}
file { '/etc/service/freeswitch':
file { '/etc/service/freeswitch':
ensure => link,
target => "/etc/sv/freeswitch",
require => File['/etc/sv'],
target => '/etc/sv/freeswitch',
require => [ File['/etc/sv'], Package['freeswitch'] ],
}
file { '/etc/service/rapi':
file { '/etc/service/rapi':
ensure => link,
target => "/etc/sv/rapi",
target => '/etc/sv/rapi',
require => File['/etc/sv'],
}
@ -143,4 +157,4 @@ file { '/etc/service/rapi':
require => Apt::Source['rhizomatica'],
}
}
}

View file

@ -0,0 +1,3 @@
#!/bin/sh
BTS1=<%= @bts1_address %>
RECIPIENTS=<%= @mail_admins %>