Asterisk SNMP

Asterisk can be monitored using SNMP. It includes a resource called res_snmp.

An article about configuring and installing SNMP can be found on Voxilla: How To: Monitor Asterisk with SNMP

Monitoring Asterisk 1.4 with SNMP and CACTI for pretty graphs!

For Asterisk version 1.8.x you can follow the Voxilla article but you will have to download the mib definition files from the Asterisk wiki because they are no longer included in the asterisk source tar file. (Asterisk mib definition,Digium mib definition)
Copy and paste the content of the two wiki pages into a new file (asterisk-mib.txt and digium-mib.txt) and save them in the /usr/share/snmp/mibs directory on your server. After installing the files you will have to restart your snmp daemon.

PHP SNMP Asterisk libraries and GUIs

  • NOCtools is a mixed bag collection of tools and utilities for NOC engineers (PHP web interface) with some Asterisk tool(s) including a wall board as a proof of concept use of the Asterisk MIBs in OSS_SNMP above. You can review it here with screenshots.

On Debian (Squeeze)

* Download the asterisk source tar file
* apt-get install libsnmp-dev
* apt-get install snmp    (if you want to check if snmpd is working allright)
* apt-get install snmpd
* apt-get install snmp-mibs-downloader
* ./configure --prefix=/usr
* make menuselect
** Go into option "Resource Modules"
** Make sure option res_snmp is marked ([[*] res_snmp)
** Save and quit (x)
* make
* make install
* make config
* Edit file /etc/asterisk/res_snmp.conf and set options enable and subagent options (in general section) to yes 
* Start asterisk
** #> /etc/init.d/asterisk start
* Connect to console and check if the SNMP resource is loaded:
** #> asterisk -rv
** ast*CLI> module show like snmp
 Module                         Description                              Use Count                    SNMP [Sub]Agent for Asterisk             0         
 1 modules loaded
** if you see the above with 1 modules loaded then everything is working allright.
** if you do not see the above check the output of your ./configure and see if it can find the net-snmp header files.
* Configure snmpd so Asterisk can connect to it
** Edit the file /etc/snmp/snmpd.conf and add the following lines to the end
 # Asterisk user
 createUser asteriskUser MD5 "<your password>" DES
 rwuser asteriskUser priv

Asterisk configuration

 master agentx
 agentXSocket	/var/agentx/master
 agentXPerms 0660 0550 nobody asterisk
** Change the <your password> part into your password.
** Change the password hashing to SHA and encryption to AES if you want higher security (createUser asteriskUser SHA "<your password>" AES)
* Install the mib definition files for Asterisk
** Copy and paste the text from the following two wiki pages into two seperate files in the /usr/share/snmp/mibs direcotry.
*** [|digium-mib.txt] 
*** [|asterisk-mib.txt] 
* Restart snmp daemon and make sure it is using the new config file.
** #> /etc/init.d/snmpd stop
** #> mv /var/lib/snmp/snmpd.conf /var/lib/snmp/snmpd.conf.old
** #> /etc/init.d/snmpd start
* Restart your asterisk.
** #> asterisk -rv
** ast*CLI> core restart when convenient
* Check if the snmp setup is working
** #> snmpwalk -v 3 -u asteriskUser -l authPriv -a MD5 -A <your password> -x DES -X <your password> ASTERISK-MIB::astVersionString
 ASTERISK-MIB::astVersionString.0 = STRING:
** You should get a valid answer telling the version of your installed asterisk. In this example version
* Now you are reading to use any of your favorite ((Asterisk monitoring|monitor tools)) which can use SNMPv3 for monitoring.

Verifying Asterisk SNMP configuration:

Test using SNMP v2:
snmpwalk -v2c -c public

Test using SNMP v3:
snmpwalk -v 3 -u asteriskUser -l authPriv -a MD5 -A <your password> -x DES -X <your password> ASTERISK-MIB::astVersionString

Created by: voipmiv, Last modification: Fri 05 of May, 2017 (21:16 UTC) by imcdona
Please update this page with new information, just login and click on the "Edit" or "Discussion" tab. Get a free login here: Register Thanks! - Find us on Google+