Today I happened to troubleshoot a server in a remote part of the world, which I had shipped with SNMP and MRTG installed. It was a very wise decision to do this at that time, as it made an important troubleshooting very simple, which otherwise could have wasted days and still yielded no results.
While going over my notes in this regard, I thought to put this information here as well if it could help someone else who is looking to do a similar setup. But you should know that setting up SNMP can be tricky and the following might not work for you.
SNMP – Simple Network Monitoring Protocol, as it name suggests, is a protocol used to monitor various properties of network equipment. These properties are identified by something called OIDs (Object Identifiers) which are long numeric strings and identify various things, like hardware version, time on the device, data flow rate, and tons of other stuff. OIDs and grouped in what is called a MIB (Management Information Base). Asterisk has a list of its own OIDs which provide various pieces of information over the SNMP when requested by a software or hardware which is interested in that information. More on SNMP you can read on the Internet.
The following assumes that you do have SNMP module installed with your asterisk installation. You select this when running the #make menuselect just before the installation of asterisk. See my blog on asterisk installation for more details.
SNMP Setup
Following are the steps which I used on this CentOS 5.3/Asterisk 1.4 machine to setup SNMP:
yum install net-snmp-util
Created /etc/snmp/snmpd.conf with the following:
rocommunity public master agentx agentXSocket /var/agentx/master agentXPerms 0660 0550 nobody asterisk com2sec local localhost public com2sec mynetwork0 192.168.1.0 public com2sec MyROGroup any local com2sec MyROGroup any mynetwork0 view all included . 1 access MyROGroup "" any noauth 0 all none none
Going into the detail of what all these lines mean is not the goal here, but the words in bold red are the ones which will be specific to your own network. The word ‘public’ is like a password, and almost all SNMP devices come preconfigured with this password. The user is ‘asterisk’, in your setup it might be ‘root’ or some other user.
Asterisk SNMP Config
Now add the following in /etc/asterisk/res_snmp.conf. If the file doesn’t exist, create one:
[general] subagent = yes enabled = yes
And now copy the Asterisk related MIB to the SNMP folder:
cp /usr/share/doc/asterisk-1.4.22/digium-mib.txt /usr/share/snmp/mibs cp /usr/share/doc/asterisk-1.4.22/asterisk-mib.txt /usr/share/snmp/mibs
It is possible that these files don’t exist on your system, in which case you’ll have to get them from the Internet.
Next do the following:
export MIBS=+ASTERISK-MIB chmod 755 /var/agentx
Done
This is all. Now restart asterisk, add snmpd and snmptrapd in chkconfig and start these services as daemons:
chkconfig snmpd on chkconfig snmptrapd on service snmpd start service snmptrapd start
Testing it
In order to test if SNMP is properly installed, do the following:
snmpwalk -On -c public -v 2c localhost asterisk
and it’ll give you a list of the asterisk related MIBS
What’s Next?
Now that you have the SNMP setup and working, how do you see it? For this we shall use MRTG, about which I shall write in a separate blog soon.

Like
aah this worked. I’ve tried so many things; this one worked. thank you.
Good to know that it worked for you. I remember the frustration which I had to go through before I was able to do this setup.