excellent primer - inspired me to draft a couple myself

Comment on Asterisk Zaptel Nagios plugin
osifanatic
Joined: Sun 25 of Apr, 2004

excellent primer - inspired me to draft a couple myself

Posted:Thu 24 of May, 2007 (07:17 UTC)
check_asterisk_odbc


 #!/bin/bash

 # ghetto fabulous first pass at monitoring the odbc socket.
 #
 # This works on the host running asterisk
 #
 # -OR- you can leverage this via "check_by_ssh" with authorized_keys
 # ex>
 #       ssh root@asteriskserver /var/www/localhost/monitoring/libexec/check_asterisk_odbc
 # 
 # ex>
 #       ./check_by_ssh -H asteriskserver -C "/var/www/localhost/monitoring/libexec/check_asterisk_odbc" -p 22
 #

OUTPUT=""
       STATUS=$(asterisk -rnx "odbc show" | grep -a "Connected:" | cut -d " " -f2)

       if [ $STATUS != "yes" ]; then
                STATUS=$(asterisk -rnx "odbc show" | grep -a "Error" | awk '{print $7,$8,$9,$10,$11,$12,$13,$14,$15,$16,$17;}')
                OUTPUT="$OUTPUT $STATUS"
                echo "Asterisk ODBC Critical, $FAILS"
                exit 2
       fi

echo "Asterisk(*) ODBC Connection OK"
exit 0