SANGOMA + status_pri + status_connected + signal_strength


log_e1.sh

#!/bin/bash

#tambahkan di /etc/rc.local so di load pada saat start up server

#created by mustafa@intelix.co.id / mustafa tambunan

# chkconfig: 2345 99 15

. /etc/rc.d/init.d/functions

RETVAL=0
DATE=$(date +%Y-%m-%d)

monit_command(){
echo “”
echo “———————————————————————”
echo “Check Log Secara realtime”
echo “———————————————————————”
echo -n “tail -f /var/www/html/log_E1/${DATE}/status_pri.log”
echo “”
echo -n “tail -f /var/www/html/log_E1/${DATE}/status_connected.log”
echo “”
echo -n “tail -f /var/www/html/log_E1/${DATE}/signal_streng_w[1-5]g1.log”
echo “”
echo “———————————————————————”
echo “http://10.10.23.23/log_E1/”
echo “”

}

start_monit_e1() {
echo -n “Starting monitoring E1 services: ”
echo “”
CMD_START_E1=”/home/ecentrix/bin/e1_monitoring/monit_e1.sh 1>/dev/null 2>&1 &”
daemon $CMD_START_E1
RETVAL=$?
echo

echo “”
monit_command

return $RETVAL
}

stop_monit_e1(){
echo -n “Stop monitoring E1 services: ”
echo “”
PID=`ps -ef|grep monit_e1.sh | grep -v grep|grep -v vi|grep -v vim|grep -v tail|awk {‘print $2’}`
if [ “$PID” != “” ];then
kill $PID
RETVAL=$?
echo
return $RETVAL
fi
}

status_monit_e1(){
PID=`ps -ef|grep monit_e1.sh | grep -v grep|grep -v vi|grep -v vim|grep -v tail|awk {‘print $2’}`
if [ “$PID” != “” ];then
echo “”
echo “Server monitoring E1 (pid 17597) is running…”
monit_command
else
echo -n “Service monitoring E1 is stopped”
echo “”
fi
}

case “$1” in
start)
# Start daemons.
stop_monit_e1
sleep 1
start_monit_e1
sleep 1
;;
stop)
# Stop daemons.
stop_monit_e1
;;
status)
status_monit_e1
;;
restart)
stop_monit_e1
sleep 1
start_monit_e1
sleep 1
;;
*)
echo “Usage: command {start|stop|status|restart}”
exit 1
esac
exit 0

 

____________________________________________________________________________________________

monit_e1.sh

#!/bin/bash

#created by mustafa@intelix.co.id / mustafa tambunan

DATE=$(date +%Y-%m-%d)
_TIME=$(date ‘+TIME = %H:%M:%S’)
LOG_DIR=”/var/www/html/log_E1/${DATE}”
mkdir -p ${LOG_DIR}
ok=0
while [ $ok -eq 0 ]; do
echo “${_TIME}” | tee -a ${LOG_DIR}/status_pri.log
/usr/sbin/asterisk -rx ‘pri show spans’ | tee -a ${LOG_DIR}/status_pri.log

echo “${_TIME}” | tee -a ${LOG_DIR}/status_connected.log
/usr/sbin/wanrouter status | grep ‘AFT’ | tee -a ${LOG_DIR}/status_connected.log

for _inteface in 1 2 3 4 5; do
echo “${_TIME}” | tee -a ${LOG_DIR}/signal_strength_w”${_interface}”g1.log
/usr/sbin/wanpipemon -i w”${_inteface}”g1 -c Ta | tee -a ${LOG_DIR}/signal_strength_w”${_interface}”g1.log
done

sleep 1
done

 

Advertisements

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s

shisdew

Listens until think alike

moses.spaceku@yahoo.com / voip ipbx

Hosted PBX, IP-PBX SOHO/ CALL CENTER, VOICE GATEWAY, VOICE CARD, COST EFECTIVE SOLUTIONS (LCR), GSM/CDMA GATEWAY

%d bloggers like this: