Icinga2 or Nagios plugin for checking asterisk status, detect long calls, disconnected SIP peers and get some stats.
Tested with PHP >= 5.4.16, Asterisk 16 and Icinga2
- Copy check_asterisk.php to Icinga2 or Nagios
PluginDir
- Copy asterisk-commnand.conf, asterisk-group.conf and asterisk-service.conf to
Icinga2 config dir/conf.d
, usually/etc/icinga2/conf.d
- Add new user in manager.conf from manager.conf
- for more accurate detection of disconnected SIP peers add
qualify=yes
to peer definition
- for more accurate detection of disconnected SIP peers add
$ check_asterisk.php -H <hostname> -P <port> -u <user> -p <password> -t <seconds> [-w unconnected WARNING] [-c unconnected CRITICAL] [-m] [-i] [-W long call WARNING] [-C long call CRITICAL] [-I] [-v] [-l logfile]
-H <hostname>
- Asterisk AMI hostname-P <port>
- Asterisk AMI port-u <username>
- Username-p <password>
- Password-t <read timeout>
- Timeout read from AMI[-v]
- Verbose output (to stdout and )[-w #]
- Unconnected peers WARNING threshold (in seconds)[-c #]
- Unconnected peers CRITICAL threshold (in seconds)[-m]
- Check only monitored peers for connected/disconnected state[-i]
- Do not set CRITICAL/WARNING state for unconnected peers[-W #]
- Long call WARNING threshold (in seconds)[-C #]
- Long call CRITICAL threshold (in seconds)[-I]
- Do not set CRITICAL/WARNING state for long calls[-l logfile]
- log output to file (relative to /var/log/)
<option>
- required option, [option]
- optional option
- Disconnected peers detect
- Logging to file
- Describe options on asterisk-commnand.conf
- Long call detection