Mod snmp

From FreeSWITCH Wiki
Jump to: navigation, search

This module is still under development, and by no means intended to be a complete read/write SNMP interface.


Reserved Object Identifier (OID)

The OID . has been reserved for FreeSWITCH. The full OID tree is documented.

Available Objects

Currently, all attributes are read-only, and are as follows:


  • .1: core
    • .1.1: identity
      • . FreeSWITCH version string (eg. "1.0.head (git-0cf1d54 2011-01-19 16-36-04 -0500)")
      • . Core UUID as a string
    • .2: systemStats
      • . FreeSWITCH uptime as SNMP TimerTicks (hundredths of seconds)
      • . Number of sessions since FreeSWITCH was started
      • . Currently active sessions
      • . Maximum allowed sessions
      • . Currently active calls
      • . Current sessions per second
      • . Maximum allowed sessions per second
      • . Peak sessions per second
      • . Peak sessions per second Last Five Minutes
      • . Peak sessions
      • . Peak sessions Last Five Minutes

Management information base (MIB)

The MIB can be viewed in FishEye. Developers will do their best to maintain backwards compatibility with regards to OIDs in the MIB, however since this module is in the early stages of development, some OIDs may change. Please use the MIB and object names, rather than hard-code OIDs in your NMS (eg. MRTG, Cacti etc) configuration.

Integration with SNMP server

The module acts as a Agent X subagent. This means it registers with your existing SNMP server to handle a specific OID, so can monitor your system and FS with a single daemon. This is a far more optimal approach than older approaches execute fs_cli to query the FreeSWITCH status via ESL.

Configuring Net-SNMP for AgentX Subagent Support

Your main snmpd will need to run as a master agent, so that mod_snmp can connect to it as a subagent over a named socket. Using the agentXPerms, make sure that you set the permissions and ownership such that your freeswitch user will be able to read/write to it.

Note that some earlier versions of Net-SNMP did not honor the agentXPerms config directive. If you find this happening, you will need to modify your snmpd init script to manually change the permissions/ownership of the socket after snmpd has started. If this is the case you'll see "Failed to connect to the agentx master agent" in the logs and /var/agentx/master will probably be owned by root:root instead of freeswitch:daemon.

#  Run as an AgentX master agent
master          agentx

#  Listen on default named socket /var/agentx/master
agentXPerms     0755 0755 freeswitch daemon

Most default configurations of Net-SNMP only allow a restricted view of the whole tree. The systemonly view is usually defined as OIDs . and . If you want to allow external hosts (or even localhost) to view the entire tree, you will need to modify the security/view parameters in snmpd.conf. Near the top of your snmpd.conf you should find the following:

# rocommunity public  localhost

Uncomment that line to allow localhost to view the entire tree (including the FreeSWITCH OID). If you wish to allow external monitoring hosts, such as MRTG, Cacti etc view more than just the systemonly view, you will need to further modify the security configuration. This procedure is outside the scope of this Wiki page, and can be found described in the manpage for snmpd.conf.

Note that to monitor snmp from external hosts, you may also need to check that snmpd is binding to either or a specified IP address. In the interests of security, many distros only bind snmpd to

Installation Prerequisites

You need to install "net-snmp-devel" or "net-snmp-dev" package and have "openssl-devel" (or openssl-dev) to be able to compile this module.

Debian Wheezy

Debian is missing MIBs for SNMP. To install them, add the non-free aptitude sources to /etc/apt/sources.list

# non-free
deb wheezy non-free
deb-src wheezy non-free

Then install snmp-mibs-downloader

apt-get update
apt-get install snmp-mibs-downloader

Testing with snmpwalk

If you have 'rocommunity public localhost' in your snmpd.conf you can test with snmpwalk. Walk the whole tree:

snmpwalk -v 1 -c public localhost .

Walk systemStats:

snmpwalk -v 1 -c public localhost .