Introduction
- SNMP Protocol Agent (PA) provides the solution for SNMP Protocol to access CCSP Data Model.
- Externally, SNMP protocol agent works like a regular SNMP agent. It takes coming SNMP requests and sends back the corresponding results or errors.
- Internally, SNMP protocol agent processes the SNMP requests and translates those into CCSP Messages. Those messages go on to CCSP Message Bus and come back with response messages. SNMP protocol agent processes the response messages and response to SNMP requests accordingly.
- In order to translate between SNMP requests and CCSP Messages, SNMP protocol agent loads the XML files describing how MIB objects are mapped to Data Model objects.
Environment Setup
By default snmp packages , systemd files are integrated in RDKB RPI Image.Also, by boot-up itself, snmp-subagent and snmpd process are running via systemd.
Use the below command to check whether snmp process are running or not,
root@RaspberryPi-Gateway:~# ps aux | grep snmp
183 root 0:00 /usr/sbin/snmpd -f -C -c /usr/ccsp/snmp/snmpd.conf -M /usr/share/snmp/mibs -Le
2501 root 0:00 /usr/bin/snmp_subagent &
5570 root 0:00 grep snmp |
---|
Systemd Status
root@RaspberryPi-Gateway:~# systemctl status snmpd ● snmpd.service - Simple Network Management Protocol (SNMP) Daemon. Loaded: loaded (/lib/systemd/system/snmpd.service; enabled; vendor preset: enabled) Active: active (running) since Wed 2020-07-29 15:03:46 UTC; 1min 19s ago Main PID: 205 (snmpd) CGroup: /system.slice/snmpd.service └─205 /usr/sbin/snmpd -f -C -c /usr/ccsp/snmp/snmpd.conf -M /usr/share/snmp/mibs -Le Jul 29 15:03:46 RaspberryPi-Gateway snmpd[205]: pcilib: pci_init failed Jul 29 15:03:46 RaspberryPi-Gateway snmpd[205]: Turning on AgentX master support. Jul 29 15:03:46 RaspberryPi-Gateway snmpd[205]: A SNMP version other than 3 was requested with (D)TLS; using 3 anyways Jul 29 15:03:46 RaspberryPi-Gateway snmpd[205]: A SNMP version other than 3 was requested with (D)TLS; using 3 anyways Jul 29 15:03:46 RaspberryPi-Gateway snmpd[205]: A SNMP version other than 3 was requested with (D)TLS; using 3 anyways Jul 29 15:03:46 RaspberryPi-Gateway snmpd[205]: A SNMP version other than 3 was requested with (D)TLS; using 3 anyways Jul 29 15:03:46 RaspberryPi-Gateway snmpd[205]: NET-SNMP version 5.8 Jul 29 15:03:46 RaspberryPi-Gateway systemd[1]: Started Simple Network Management Protocol (SNMP) Daemon.. Jul 29 15:03:55 RaspberryPi-Gateway snmpd[205]: Name of an interface changed. Such interfaces will keep its old name in IF-MIB. Jul 29 15:04:25 RaspberryPi-Gateway snmpd[205]: IfIndex of an interface changed. Such interfaces will appear multiple times in IF-MIB. root@RaspberryPi-Gateway:~# ls /lib/systemd/system/snmpSubAgent.service /lib/systemd/system/snmpSubAgent.service
root@RaspberryPi-Gateway:~# systemctl status snmpSubAgent ● snmpSubAgent.service - SNMP Subagent service Loaded: loaded (/lib/systemd/system/snmpSubAgent.service; enabled; vendor preset: enabled) Active: active (running) since Wed 2020-07-29 15:04:05 UTC; 1min 29s ago Main PID: 2624 (snmp_subagent) CGroup: /system.slice/snmpSubAgent.service └─2624 /usr/bin/snmp_subagent &
Jul 29 15:04:05 RaspberryPi-Gateway systemd[1]: Started SNMP Subagent service. Jul 29 15:04:06 RaspberryPi-Gateway snmp_subagent[2624]: unknown snmp version 193 Jul 29 15:04:06 RaspberryPi-Gateway snmp_subagent[2624]: NET-SNMP version 5.8 AgentX subagent connected Jul 29 15:04:06 RaspberryPi-Gateway snmp_subagent[2624]: PID path is /var/tmp/snmp_subagent_v2.pid Jul 29 15:04:06 RaspberryPi-Gateway snmp_subagent[2624]: ccsp-snmp-subagent is up and running. root@RaspberryPi-Gateway:~# |
---|
Netstat Command
Using netstat command to check the snmpd status
root@RaspberryPi-Gateway:~# netstat -lutpn | grep snmp netstat: showing only processes with your user ID tcp 0 0 127.0.0.1:1161 0.0.0.0:* LISTEN 205/snmpd tcp 0 0 127.0.0.1:705 0.0.0.0:* LISTEN 205/snmpd udp 0 0 0.0.0.0:10161 0.0.0.0:* 205/snmpd udp 0 0 0.0.0.0:10163 0.0.0.0:* 205/snmpd udp 0 0 0.0.0.0:161 0.0.0.0:* 205/snmpd udp 0 0 :::10161 :::* 205/snmpd udp 0 0 :::10163 :::* 205/snmpd udp 0 0 :::161 :::* 205/snmpd root@RaspberryPi-Gateway:~#
|
---|
Execution Commands
Using snmpget/snmpset commands are used to control and monitor the Gateway device.
Sample Snmpget Command
snmpget command is used for particular OID .
snmpget -OQ -Ir -v 2c -c public < WAN_IP(erouter0 IP Address> <OID>
For Example,
root@RaspberryPi-Gateway:~# snmpget -OQ -Ir -v 2c -c public 192.168.0.108 1.3.6.1.4.1.17270.50.2.2.2.1.1.3.10001
SNMPv2-SMI::enterprises.17270.50.2.2.2.1.1.3.10001 = "New_SSID" |
---|
Sample SnmpSet Command
snmpset command is used for particular OID .
snmpset -OQ -Ir -v 2c -c private <WAN_IP(erouter0 IP Address)> <OID> s <VALUE>
For Example,
It will update the existing SSID to new SSID and will broadcast the new one. You can confirm the same by running snmpget command again or by checking in /nvram/hostapd0.conf file
root@RaspberryPi-Gateway:~# snmpset -OQ -Ir -v 2c -c private 192.168.0.108 1.3.6.1.4.1.17270.50.2.2.2.1.1.3.10001 s RDKB_RPI_2G
SNMPv2-SMI::enterprises.17270.50.2.2.2.1.1.3.10001 = "RDKB_RPI_2G"
root@RaspberryPi-Gateway:~#
root@RaspberryPi-Gateway:~#
root@RaspberryPi-Gateway:~# snmpget -OQ -Ir -v 2c -c public 192.168.0.108 1.3.6.1.4.1.17270.50.2.2.2.1.1.3.10001
SNMPv2-SMI::enterprises.17270.50.2.2.2.1.1.3.10001 = "RDKB_RPI_2G"
root@RaspberryPi-Gateway:~# dmcli eRT getv Device.WiFi.SSID.1.SSID
CR component name is: eRT.com.cisco.spvtg.ccsp.CR
subsystem_prefix eRT.
getv from/to component(eRT.com.cisco.spvtg.ccsp.wifi): Device.WiFi.SSID.1.SSID
Execution succeed.
Parameter 1 name: Device.WiFi.SSID.1.SSID
type: string, value: RDKB_RPI_2G |
---|
SnmpWalk Command
snmpwalk command is used for to fetch all the oids under a tree
Command :
snmpwalk -t 60 -c public -v 2c <WAN IP : erouter0 IP Address> 1.3.6.1.4.1.17270
Here, this will list all the oids under 17270
Troubleshooting
Please check whether the snmp-subagent,snmpd process are running or not by using PS command.
snmp Logs
SNMP Logs will be generated in below path,
Location of SNMP MIB and CONF files
Please check whether the SNMP MIB xml files and conf are present in below location or not,