Random Project

work – with fixes

Hello,

works with Asterisk after a fix…
Nice for global overview / if you have only 1 trunk. It has no sseparate channel monitoring splitted by peer (hope it is readable):

# diff -p nagios_check_channels.sh{.orig,}
*** nagios_check_channels.sh.orig 2012-06-26 19:19:46.000000000 +0200
— nagios_check_channels.sh 2012-06-01 20:50:52.000000000 +0200
***************
*** 5,17 ****
# Last Modified: 2009-02-28

ASTERISK=/usr/sbin/asterisk
!
PROGPATH=`dirname $0`
REVISION=`echo ‘$Revision: 1 $’ | sed -e ‘s/[^0-9.]//g’`
DATETIME=`date “+%Y-%m-%d %H:%M:%S”`
TAB=” ”

! . $PROGPATH/utils.sh

print_usage() {
echo ”
— 5,18 —-
# Last Modified: 2009-02-28

ASTERISK=/usr/sbin/asterisk
! NAGIOS_PLUGINS=”/usr/lib/nagios/plugins/”
PROGPATH=`dirname $0`
REVISION=`echo ‘$Revision: 1 $’ | sed -e ‘s/[^0-9.]//g’`
DATETIME=`date “+%Y-%m-%d %H:%M:%S”`
TAB=” ”

! #. $PROGPATH/utils.sh
! . $NAGIOS_PLUGINS/utils.sh

print_usage() {
echo ”
*************** command_output=`$ASTERISK -rx “core show
*** 190,198 ****
check_asterisk_result $? “$command_output”

# Parse the data.
! call_data=`echo “$command_output” | tail -n 2`
active_channels=`echo “$call_data” | head -n 1 | cut -f 1 -d ” “`
! active_calls=`echo “$call_data” | tail -n 1 | cut -f 1 -d ” “`

# Test for warning/critical channels.
if [ “$channels_critical” != “-1” ] && [ “$active_channels” -gt “$channels_critical” ]; then
— 191,199 —-
check_asterisk_result $? “$command_output”

# Parse the data.
! call_data=`echo “$command_output” | tail -n 4`
active_channels=`echo “$call_data” | head -n 1 | cut -f 1 -d ” “`
! active_calls=`echo “$call_data” | head -n 2 | tail -n 1 | cut -f 1 -d ” “`

# Test for warning/critical channels.
if [ “$channels_critical” != “-1” ] && [ “$active_channels” -gt “$channels_critical” ]; then
*************** esac
*** 230,232 ****
— 231,235 —-
echo “${exit_message}: $active_channels active channels, $active_calls active calls | ${DATETIME}${TAB}${active_channels}${TAB}${active_calls}”;

exit $exitstatus