Home Directory Plugins Telephony Asterisk check_asterisk_channels

Search Exchange

Search All Sites

Nagios Live Webinars

Let our experts show you how Nagios can help your organization.

Contact Us

Phone: 1-888-NAGIOS-1
Email: sales@nagios.com

Login

Remember Me

Directory Tree

check_asterisk_channels

Rating
1 vote
Favoured:
0
Hits
103956
Files:
FileDescription
check_asterisk_channelscheck_asterisk_channels
Nagios CSP

Meet The New Nagios Core Services Platform

Built on over 25 years of monitoring experience, the Nagios Core Services Platform provides insightful monitoring dashboards, time-saving monitoring wizards, and unmatched ease of use. Use it for free indefinitely.

Monitoring Made Magically Better

  • Nagios Core on Overdrive
  • Powerful Monitoring Dashboards
  • Time-Saving Configuration Wizards
  • Open Source Powered Monitoring On Steroids
  • And So Much More!
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.
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)
byReiner030, June 26, 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