Compiling Asterisk with the res_snmp module

Asterisk 1.6 and newer has the ability to be monitored via SNMP, but the FreePBX 2.10 distro, which I have, doesn’t have the res_snmp module compiled into it. I have two questions about this:

  1. Can future releases of the distro include the res_snmp module?
  2. How do we add the res_snmp module to existing distro installations?

I’m also interested in this. Did you ever find a solution to getting SNMP running with FreePBX distros?

Olly

Guys all 3 of our Asterisk versions have the snmp RPM. Do a yum list all | grep asterisk from your box and you will see it. Then you can yum install it.

I think the OP is referring to having SNMP compiled into Asterisk so you can use Net-SNMP to monitor Asterisk.

oliverm, I did not find a solution to getting the res_snmp module into FreePBX. I would still like to be able to monitor server usage directly via SNMP.

alan_mousty is right. The problem is the missing res_snmp module in FreePBX, not SNMP at the OS layer.

Yes that is what I am saying. We have compiled SNMP into Asterisk. You just need to yum install the package. It is their.

Tony

I think one of the problems is that there is no res_snmp.so in /usr/lib64/asterisk/modules. When I try to load it from the CLI I get

*CLI> module load res_snmp.so Unable to load module res_snmp.so Command 'module load res_snmp.so' failed. [2013-05-31 10:10:05] WARNING[4240]: loader.c:409 load_dynamic_module: Error loading module 'res_snmp.so': /usr/lib64/asterisk/modules/res_snmp.so: cannot open shared object file: No such file or directory [2013-05-31 10:10:05] WARNING[4240]: loader.c:874 load_resource: Module 'res_snmp.so' could not be loaded.
yum list all | grep asterisk | grep snmp asterisk10-snmp.x86_64 10.12.1-82_centos6 pbx asterisk11-snmp.x86_64 11.3.0-44_centos6 pbx asterisk18-snmp.x86_64 1.8.21.0-41_centos6 pbx

I’ve installed the Asterisk 8 RPMs using the yum list all | grep asterisk | grep snmp command and it installed ok.

However using the Asterisk MIBs on the Asterisk wiki, I dont see any of the asterisk OIDs showing. I assumed there was some other bit that needed to be done.

Glad it’s not just me though :slight_smile:

Here is my raw unedited cheat sheet for Asterisk snmp. Most of this is done by the RPM via yum but hopefully it will help:

cd /etc/snmp
ls

cp /usr/src/asterisk-1.6.2.17.2/doc/*-mib.txt /usr/share/snmp/mibs/
chkconfig snmpd on
ls -al /var/agentx
service snmpd start
ls -al /var/agentx
chmod 755 /var/agentx
ls -al /var/agentx
service snmpd restart
service asterisk restart
snmpwalk -On -c community -v 2c localhost .1.3.6.1.4.1.22736

If not res_snmp.so cure the following dependencies:

Asterisk SNMP support is provided by the res_snmp module. To build this module, you need to install the following packages:

•net-snmp
•net-snmp-devel
•net-snmp-utils
•bzip2
•bzip2-devel
•lm_sensors
•lm_sensors-devel
•newt
•newt-devel

I am also having a heck of a time getting asterisk SNMP working. I have basic SNMP working I am just trying to get Asterisk MIBs working.

I am running FreePBX distro 4.211.64-5 and installed asterisk11-snmp.x86_64 but I don’t know what it did or what further I need to do.

I placed the MIBs from Asterisk in /usr/share/snmp/mibs

I tried adding the following to /etc/snmp/snmpd.conf and restarting asterisk and snmp

Enable AgentX support

master agentx

Set permissions on AgentX socket and containing

directory such that process in group ‘asterisk’

will be able to connect

agentXPerms 0660 0550 nobody asterisk

https://wiki.asterisk.org/wiki/display/AST/Simple+Network+Management+Protocol+(SNMP)+Support

Other people say I need /etc/asterisk/res_snmp.conf but it isn’t there and if I make it myself it still does not work.

When I do a SNMP walk I get the following.

No log handling enabled - turning on stderr logging
Cannot find module (DIGIUM): At line 0 in (none)
SNMPv2-SMI::enterprises.22736 = No Such Object available on this agent at this OID

OK I finally got this working, I will post the process I used on my blog and post back here later.

I look forward to to it. It would be very useful to get Asterisk snmp working on freepbx.

Here is my post on getting SNMP setup, let me know how it works for you.

http://deobfuscate.net/2013/09/05/configuring-snmp-v3-for-asterisk-on-freepbx/

I’ll try it out later today, thanks.

What SNMP stats are you seeing from asterisk?

I’ve posted a comment to your blog. I can’t get the /var/agentx line to work.

Olly

We generally do not allow links back to other sites from the forums. Can we give you access to add information to wiki.freepbx.org and would you be ok posting this their?

That directory should get created after adding the code to snmp.conf file and restarting it. I updated the blog post. As for the stats I am getting back there are quite a few, however the system I set it up on has not gone into production yet so I can’t say which will be useful. Below are some of them, there were also ones for trunk types like SIP AIX etc but those didn’t seem to have much useful information.

I am going to be redoing the server I used before to write the article so I will follow my blog post and update it as needed.

asterisk configuration/ast config calls active

asterisk configuration/ast config calls processed

asterisk configuration/ast config pid

asterisk configuration/ast config reload time

asterisk configuration/ast config socket

asterisk configuration/ast config up time

asterisk indications/ast current indication

asterisk indications/ast num indications

asterisk modules/ast num modules

asterisk version/ast version string

asterisk version/ast version tag

I updated the post as it was not correct, it should work well now.

Only to find it right at “home”…

http://yum.freepbxdistro.org/pbx/1.810.210.57/i386/RPMS/digium/asterisk/1.8.10.0/asterisk18-snmp-1.8.10.0-24_centos5.i386.rpm

There are a few other versions there too in the same folder, if your yum can’t find it (mine didn’t)
Works great now.