How to I get the gateway Cellular RSSI from Cisco IOx ?
If you have an IOx application that requires tp capture the cellular modem signal strength (for example to include in telemetry data along with GPS position and map signal with location), you will find that there is no direct way to get it from IOx. The reason is that the application hosting environment is virtualized and therefore Cisco IOS metrics are not directly accessible.
Simple Network Management Protocol (SNMP) which is an IOS feature can be leverage to exposed this variable or any other SNMP variable. SNMP can be easily configured on the gateway with just a few lines:
On a Cisco IR829 with guest-os running in the 192.168.1.0/24 range, where 192.168.1.1 is being assigned to the virtual Gigabit Ethernet 5 interface, then this is what it takes to give SNMP access to all the virtual instances running on the gateway:
IR829(config)# access-list 10 permit 192.168.1.0 0.0.0.255
IR829(config)# snmp-server community public RO 10
The IOx application can then poll the right SNMP OIDs straight from the gateway, and this OID may change depending on the particular model. Always refer the device's MIB.
For example in Python to poll both cellular interface's RSSI on a Cisco IR829M:
from pysnmp.entity.rfc3413.oneliner import cmdgen
import time
SNMP_HOST = '192.168.1.1'
SNMP_PORT = 161
SNMP_COMMUNITY = 'public'
cmdGen = cmdgen.CommandGenerator()
errorIndication, errorStatus, errorIndex, varBinds = cmdGen.getCmd(
cmdgen.CommunityData(SNMP_COMMUNITY),
cmdgen.UdpTransportTarget((SNMP_HOST, SNMP_PORT)),
'1.3.6.1.4.1.9.9.661.1.3.4.1.1.1.20',
'1.3.6.1.4.1.9.9.661.1.3.4.1.1.1.21'
)
for name, val in varBinds:
print('%s = %s' % (name.prettyPrint(), val.prettyPrint()))
You should see the RSSI signal (in dBm) returned like so:
SNMPv2-SMI::enterprises.9.9.661.1.3.4.1.1.1.20 = -128
SNMPv2-SMI::enterprises.9.9.661.1.3.4.1.1.1.21 = -128