Table of Contents
Kamailio and SNMP
There is a blog post by Sven Schulz providing the steps to setup Kamailio 1.4.4 with SNMP, link:
For persistence purpose, the blog post is mirrored here.
Kamailio and SNMP HowTo
Here is a quick how-to on how to setup snmpstats module. This was on kamailio-1.4.4 and CentOS.
Make sure you install the prerequisites
yum install lm_sensors-devel net-snmp net-snmp-devel net-snmp-utils
Compile kamailio with snmpstats module
Add this to kamailio.cfg file
loadmodule "snmpstats.so" .. # ----- snmpstats params ---- modparam("snmpstats", "sipEntityType", "registrarServer") modparam("snmpstats", "snmpgetPath", "/usr/bin/")
Create a bare-bones /etc/snmp/snmpd.conf file
rocommunity public master agentx agentXSocket tcp:localhost:705
Create a /etc/snmp/snmpstats.conf file (this tells the snmpstats module where to send its snmp data).
agentXSocket tcp:localhost:705
If you are using a snmp.conf file, make sure this is in it
defVersion 2c defCommunity public mibdirs /usr/share/snmp/mibs mibs +ALL
Inside the /usr/share/snmp/mibs/ directory, append all OPENSER-* files with a .txt extension.
Testing
Start the snmpd daemon manually
snmpd -f -Dagentx -x tcp:localhost:705 2>&1
Restart kamailio and enjoy!
snmpwalk localhost openser
Should output something like this:
OPENSER-SIP-COMMON-MIB::openserSIPProtocolVersion.0 = STRING: SIP/2.0 OPENSER-SIP-COMMON-MIB::openserSIPServiceStartTime.0 = Timeticks: (692) 0:00:06.92 OPENSER-SIP-COMMON-MIB::openserSIPEntityType.0 = BITS: 08 registrarServer(4) OPENSER-SIP-COMMON-MIB::openserSIPTransportRcv.ipv4."127.0.0.1".5060 = BITS: 60 udp(1) tcp(2) OPENSER-SIP-COMMON-MIB::openserSIPTransportRcv.ipv4."146.186.8.100".5060 = BITS: 60 udp(1) tcp(2) OPENSER-SIP-COMMON-MIB::openserSIPMethodName.1 = STRING: METHOD_INVITE OPENSER-SIP-COMMON-MIB::openserSIPMethodName.2 = STRING: METHOD_CANCEL OPENSER-SIP-COMMON-MIB::openserSIPMethodName.3 = STRING: METHOD_ACK OPENSER-SIP-COMMON-MIB::openserSIPMethodName.4 = STRING: METHOD_BYE OPENSER-SIP-COMMON-MIB::openserSIPMethodName.5 = STRING: METHOD_INFO OPENSER-SIP-COMMON-MIB::openserSIPMethodName.8 = STRING: METHOD_REGISTER OPENSER-SIP-COMMON-MIB::openserSIPMethodName.9 = STRING: METHOD_MESSAGE OPENSER-SIP-COMMON-MIB::openserSIPMethodName.10 = STRING: METHOD_SUBSCRIBE OPENSER-SIP-COMMON-MIB::openserSIPMethodName.11 = STRING: METHOD_NOTIFY OPENSER-SIP-COMMON-MIB::openserSIPMethodName.12 = STRING: METHOD_PRACK OPENSER-SIP-COMMON-MIB::openserSIPMethodName.13 = STRING: METHOD_REFER OPENSER-SIP-COMMON-MIB::openserSIPMethodName.14 = STRING: METHOD_PUBLISH OPENSER-SIP-COMMON-MIB::openserSIPSummaryInRequests.0 = Counter32: 28 OPENSER-SIP-COMMON-MIB::openserSIPSummaryOutRequests.0 = Counter32: 0 OPENSER-SIP-COMMON-MIB::openserSIPSummaryInResponses.0 = Counter32: 0 OPENSER-SIP-COMMON-MIB::openserSIPSummaryOutResponses.0 = Counter32: 28 OPENSER-SIP-COMMON-MIB::openserSIPSummaryTotalTransactions.0 = Counter32: 4 OPENSER-SIP-COMMON-MIB::openserSIPCurrentTransactions.0 = Gauge32: 0 OPENSER-SIP-COMMON-MIB::openserSIPNumUnsupportedUris.0 = Counter32: 0 OPENSER-SIP-COMMON-MIB::openserSIPNumUnsupportedMethods.0 = Counter32: 0 OPENSER-SIP-COMMON-MIB::openserSIPOtherwiseDiscardedMsgs.0 = Counter32: 0 OPENSER-SIP-SERVER-MIB::openserSIPProxyStatefulness.0 = INTEGER: transactionStateful(2) OPENSER-SIP-SERVER-MIB::openserSIPProxyRecordRoute.0 = INTEGER: true(1) OPENSER-SIP-SERVER-MIB::openserSIPProxyAuthMethod.0 = BITS: 20 digest(2) OPENSER-SIP-SERVER-MIB::openserSIPNumProxyRequireFailures.0 = Counter32: 0 OPENSER-SIP-SERVER-MIB::openserSIPRegMaxContactExpiryDuration.0 = Gauge32: 0 seconds OPENSER-SIP-SERVER-MIB::openserSIPRegMaxUsers.0 = Gauge32: 4294967295 OPENSER-SIP-SERVER-MIB::openserSIPRegCurrentUsers.0 = Gauge32: 0 OPENSER-SIP-SERVER-MIB::openserSIPRegDfltRegActiveInterval.0 = Gauge32: 3600 seconds OPENSER-SIP-SERVER-MIB::openserSIPUserUri.1 = STRING: DefaultUser OPENSER-SIP-SERVER-MIB::openserSIPUserUri.3 = STRING: sus21 OPENSER-SIP-SERVER-MIB::openserSIPUserAuthenticationFailures.1 = Counter32: 0 OPENSER-SIP-SERVER-MIB::openserSIPUserAuthenticationFailures.3 = Counter32: 0 OPENSER-SIP-SERVER-MIB::openserSIPContactDisplayName.1.1 = STRING: DefaultUser OPENSER-SIP-SERVER-MIB::openserSIPContactDisplayName.3.3 = STRING: sip:sus21@146.186.115.180:57044;rinstance=fffd4ead92eef4f3 OPENSER-SIP-SERVER-MIB::openserSIPContactURI.1.1 = STRING: DefaultUser OPENSER-SIP-SERVER-MIB::openserSIPContactURI.3.3 = STRING: sip:sus21@146.186.115.180:57044;rinstance=fffd4ead92eef4f3 OPENSER-SIP-SERVER-MIB::openserSIPContactLastUpdated.1.1 = STRING: 0-0-0,0:0:0.0 OPENSER-SIP-SERVER-MIB::openserSIPContactLastUpdated.3.3 = STRING: 2009-9-15,14:12:20.0 OPENSER-SIP-SERVER-MIB::openserSIPContactExpiry.1.1 = STRING: 0-0-0,0:0:0.0 OPENSER-SIP-SERVER-MIB::openserSIPContactExpiry.3.3 = STRING: 2009-9-15,15:12:20.0 OPENSER-SIP-SERVER-MIB::openserSIPContactPreference.1.1 = STRING: -0.01 OPENSER-SIP-SERVER-MIB::openserSIPContactPreference.3.3 = STRING: -0.01 OPENSER-SIP-SERVER-MIB::openserSIPRegUserLookupCounter.0 = Counter32: 10 OPENSER-SIP-SERVER-MIB::openserSIPRegAcceptedRegistrations.0 = Counter32: 12 OPENSER-SIP-SERVER-MIB::openserSIPRegRejectedRegistrations.0 = Counter32: 0 OPENSER-MIB::openserMsgQueueDepth.0 = Gauge32: 0 OPENSER-MIB::openserMsgQueueMinorThreshold.0 = INTEGER: -1 OPENSER-MIB::openserMsgQueueMajorThreshold.0 = INTEGER: -1 OPENSER-MIB::openserMsgQueueDepthAlarmStatus.0 = BITS: 00 OPENSER-MIB::openserMsgQueueDepthMinorAlarm.0 = INTEGER: clear(0) OPENSER-MIB::openserMsgQueueDepthMajorAlarm.0 = INTEGER: clear(0) OPENSER-MIB::openserCurNumDialogs.0 = Gauge32: 0 OPENSER-MIB::openserCurNumDialogsInProgress.0 = Gauge32: 0 OPENSER-MIB::openserCurNumDialogsInSetup.0 = Gauge32: 0 OPENSER-MIB::openserTotalNumFailedDialogSetups.0 = Counter32: 0 OPENSER-MIB::openserDialogLimitMinorThreshold.0 = INTEGER: -1 OPENSER-MIB::openserDialogLimitMajorThreshold.0 = INTEGER: -1 OPENSER-MIB::openserDialogUsageState.0 = INTEGER: idle(0) OPENSER-MIB::openserDialogLimitAlarmStatus.0 = BITS: 00 OPENSER-MIB::openserDialogLimitMinorAlarm.0 = INTEGER: clear(0) OPENSER-MIB::openserDialogLimitMajorAlarm.0 = INTEGER: clear(0)