Asterisk

check_asterisk_channels

Description:

This plugin checks an asterisk server for active channels and calls, and issues alerts if any defined thresholds are exceeded. Performance data is also returned for both active channels and calls.

Current Version

Last Release Date

June 18, 2009

Compatible With


Project Files
Project Notes
Usage: check_asterisk_channels [-w ] [-c ] [-W ] [-C ] Usage: check_asterisk_channels --help | -h Description: This plugin checks an asterisk server for active channels and calls, and issues alerts if any defined thresholds are exceeded. Performance data is also returned for both active channels and calls. Tested to work on Linux. The following arguments are accepted: -w (Optional) Generate a warning message if the defined number channels is exceeded. -c (Optional) Generate a critical message if the defined number channels is exceeded. -W (Optional) Generate a warning message if the defined number calls is exceeded. -C (Optional) Generate a critical message if the defined number calls is exceeded. --help | -h Print this help and exit. Examples: Check channels/calls, with no concern about limits. check_asterisk_channels Check channels/calls. Issue a warning if there are more than 10 active channels, and a critical if there are more than 15 active channels. check_asterisk_channels -w 10 -c 15 Caveats: This plugin calls the asterisk executable directly, so make sure that the user executing this script has appropriate permissions! Usually the asterisk binary can only be run by the asterisk user or root. To grant the nagios user permissions to execute the script, try something like the following in your /etc/sudoers file: nagios ALL=(ALL) NOPASSWD: /path/to/plugins/directory/check_asterisk_channels Then call the plugin using sudo: /path/to/sudo check_asterisk_channels
Reviews (1) Add a Review
work - with fixes
by Reiner030, June 30, 2012

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



Add a Review

You must be logged in to submit a review.

Thank you for your review!

Your review has been submitted and is pending approval.

Recommend

To:


From:


Thank you for your recommendation!

Your recommendation has been sent.

Project Stats
Rating
4 (1)
Favorites
0
Views
103,961