Build precise queries to find exactly what you need
Press ESC to close
Join our next live webinar: “Advanced Nagios Monitoring Techniques” – Register Now
Your review has been submitted and is pending approval.
This plugin checks Asterisk peers to make sure they are in a healthy state. Unlike other monitoring plugins, status is obtained from the perspective of the Asterisk server — it’s a good plugin to use for monitoring the state of your connections to providers.
Current Version
Last Release Date
June 18, 2009
Owner
Nagios Exchange
Compatible With
Version 1.0
Version 2.0
Usage: check_asterisk_peers [--type | -t ] [--peers | -p ] [--registrations | -r ] [--verify-peers] [--verify-registrations] [--config-file ] Usage: check_asterisk_peers --help | -h Description: This plugin checks Asterisk peers via Asterisk CLI commands to make sure they are in a healthy state. Unlike other monitoring plugins, status is obtained from the perspective of the Asterisk server -- it's a good plugin to use for monitoring the state of your connections to providers. Both the peer itself and registration status to a peer can be monitored, with the option of verifying that the peer/registration is actively configured. If any of the checked peers/registrations return a non-OK state, a critical state is returned. If verification is being used and a peer/registration is not verified as being in the active configuration, then the status check is skipped for that item instead of a critical state being returned. Tested to work on Linux. The following arguments are accepted: --type | -t (Optional) The type of peer to check. Valid values are sip, iax. Defaults to sip. --peers | -p (Optional) A space separated list of peers to check. Use the peer name given in the configuration, without the surrounding brackets. --registrations | -r (Optional) A space separated list of registrations to check, in the form of username@uri. For example, to check the registration of peer foo to somesite.com, use [email protected] --verify-peers (Optional) If set, peer entries are verified in the configuration, and the check is skipped if they are not found. --verify-registrations (Optional) If set, registrations are verified in the configuration, and the check is skipped if they are not found. --config-file (Optional) The location of the configuration file(s). Use a space separated list if specifying multiple files. Default value is based on the --type setting: sip: /etc/asterisk/sip.conf iax: /etc/asterisk/iax.conf --help | -h Print this help and exit. Examples: Check peers [foo] and [bar]: check_asterisk_peers -p "foo bar" Check peers [foo] and [bar], and registration for usr baz at somesite.com, and verify that both the peers and the registration are actively configured. check_asterisk_peers -p "foo bar" -r "[email protected]" --verify-peers --verify-registrations Caveats: The verification checks will not work correctly if there is any leading or trailing whitespace on any of the register statement lines or the peer section headings. This plugin does not work with Realtime. 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_peers Then call the plugin using sudo: /path/to/sudo check_asterisk_peers
Hello, please help me. This script locally works fine, but i have issue with arguments on nagios monitoring server Client side with asterisk is working fine. After entering command ./check_asterisk_peers -t sip -p 10 i get ERROR: 10: Not found It's ok because extension 10 is not registered In /etc/nagios/nrpe.conf command is defined as: command[check_asterisk_peers]=/usr/lib/nagios/plugins/check_asterisk_peers -t sip -p sip channel ------- Command line on nagios monitoring server:./check_nrpe -H 192.168.1.109 -c check_asterisk_peers -a "-p 10" i get this: ERROR: sipchannel: Not found Argument with -p 10 is ignored. Please help me with correct syntax in nrpe.conf Another question... How to define service with checking extension 10 in nagios?
had problems with your script, so i modified it. Especially the register part was not working for me under 1.6.2 ($ character after {uri}). Not sure why the user was cut off at 12 chars, removed that, because didnt work. I included also checking delay because the trunk should not go under 100ms if you want to have a reliable jitter free phone connection. http://pastebin.com/6XxU5k0w
--- check_asterisk_peers 2011-11-05 11:56:16.352105211 +0100 +++ check_asterisk_peers.sh 2011-11-05 11:56:11.376105311 +0100 @@ -1,4 +1,4 @@ -#!/bin/sh +#!/bin/bash # Check asterisk peers plugin for Nagios. # Written by Chad Phillips ([email protected]) @@ -7,6 +7,7 @@ ASTERISK=/usr/sbin/asterisk PROGPATH=`dirname $0` +PROGPATH="/usr/lib/nagios/plugins" REVISION=`echo '$Revision: 2 $' | sed -e 's/[^0-9.]//g'` . $PROGPATH/utils.sh @@ -333,9 +334,11 @@ if [ "$registration_verified" ]; then # Have to cut off registration name at 12 characters, so let's hope # it's still unique! - cut_user=${user:0:12} + #cut_user=${user:0:12} + cut_user=${r:0:12} # This regex isn't perfect, but it does the trick ok. - status=`echo "$command_output" | grep "^${uri}:[[:digit:]].+[[:space:]].+${cut_user}[[:space:]].+" | awk '{print $4;}'` + #status=`echo "$command_output" | grep "^${uri}:[[:digit:]].+[[:space:]].+${cut_user}[[:space:]].+" | awk '{print $4;}'` + status=`echo "$command_output" | grep "^${uri}:[[:digit:]].+[[:space:]].+[[:alpha:]].+${cut_user}[[:space:]].+" | awk '{print $5;}'` if [ "$status" = "Registered" ]; then if [ "$test_ok" ]; then test_ok="${test_ok}, $r"
Couple things about this 1) - It is outdated for the newer releases of asterisk 2) - the config files portion doesn't add in the absolute path to the files (it just grabs whatever is in the sip.conf - which usually doesn't have the /etc/asterisk)
Can anyone mention how to install it. I failed in finding instructions to install this plugin and other plugins
Hi, This is an excellent plugin. But it can be great if it can also check the latency of the peer which is reported by asterisk via the "iax2 show peers" command and set warning/critical threshold, like check_iax does. Yuval
You must be logged in to submit a review.
To:
From: