Using the management API with SNMP

If SNMP is enabled on each Conferencing Node and the Management Node, you can use the Management API to obtain information using SNMP.

Note that SNMP is disabled by default, and is enabled and disabled on each node individually. For more information, see Monitoring via SNMP.

Examples

The examples below assume a community name of public (this is the default value and so is insecure).

Retrieving the SNMP sysName

# Retrieve the SNMPv2-MIB 'sysName' using an SNMP GET operation using SNMPV2c
from pysnmp.entity.rfc3413.oneliner import cmdgen
pexip_node_ip_address = '<pexipipaddress>'
cmdGen = cmdgen.CommandGenerator()
error_indication, error_status, error_index, var_binds = cmdGen.getCmd(
    cmdgen.CommunityData('public'),
    cmdgen.UdpTransportTarget((pexip_node_ip_address, 161)),
    cmdgen.MibVariable('SNMPv2-MIB', 'sysName', 0)
)
# Check for errors and print out results
if not error_indication and not error_status:
    for name, val in var_binds:
        print('%s = %s' % (name.prettyPrint(), val.prettyPrint()))
else:
    if error_indication:
        print(error_indication)
    if error_status:
        print('%s at %s' % (error_status.prettyPrint(),  error_index and var_binds[int(error_index)-1] or '?') )

Retrieving CPU load average

The value returned is on a scale where 1.00 equals one CPU core at full load. So a 4 CPU system would return values between 0.00 (completely idle) and 4.00 (completely maxed out).

# Retrieve the 1 minute CPU load average (OID: '.1.3.6.1.4.1.2021.10.1.3.1')
# using an SNMP GET operation using SNMPV2c
from pysnmp.entity.rfc3413.oneliner import cmdgen
pexip_node_ip_address = '<pexipipaddress>'
cmdGen = cmdgen.CommandGenerator()
error_indication, error_status, error_index, var_binds = cmdGen.getCmd(
    cmdgen.CommunityData('public'),
    cmdgen.UdpTransportTarget((pexip_node_ip_address, 161)),
    '.1.3.6.1.4.1.2021.10.1.3.1'
)
# Check for errors and print out results
if not error_indication and not error_status:
    for name, val in var_binds:
        print('%s = %s' % (name.prettyPrint(), val.prettyPrint()))
else:
    if error_indication:
        print(error_indication)
    if error_status:
        print('%s at %s' % (error_status.prettyPrint(),  error_index and var_binds[int(error_index)-1] or '?') )