Question & Answer
Question
How do I enable SNMP polling on the PureData System for Analytics host?
Answer
To configure an SNMP server, you need to define the community strings in the following configuration file:
/etc/snmp/snmpd.conf
The version of the configuration file that comes with SNMP is quite complicated. A simpler version will suffice for the setup of an example here:
1. Before editting the configuration file, make a file backup by entering the following commands:
# cd /etc/snmp/
# mv snmpd.conf snmpd.conf.old
2. In a new file, set the Read Only community string to testuser by entering the following on the first line:
rocommunity testuser
3. Save the file as /etc/snmp/snmpd.conf. This should be the only line in the file.
4. Configure the SNMP services on each reboot with the following command:
# chkconfig snmpd on
5. Restart SNMP to load the new configuration file:
# service snmpd restart
If the service does not start up correctly, check the configuration file for errors.
6. To test whether SNMP can read the system and interface information from the NPS server, run the following two commands.
snmpwalk -v 1 -c testuser <nps_server> system
snmpwalk -v 1 -c testuser <nps_server> interface
Replace <nps_server> with the ip address or name of the NPS server. If these commands return information, then SNMP is set up correctly. If not, check the configuration file for errors.
The output will be similar to the following:
nz@spubox:~$ snmpwalk -v 1 -c testuser spubox system
SNMPv2-MIB::sysDescr.0 = STRING: Linux helios 2.6.9-42.ELsmp #1 SMP Wed Jul 12 23:27:17 EDT 2006 i686
SNMPv2-MIB::sysObjectID.0 = OID: NET-SNMP-MIB::netSnmpAgentOIDs.10
DISMAN-EVENT-MIB::sysUpTimeInstance = Timeticks: (35101) 0:05:51.01
SNMPv2-MIB::sysContact.0 = STRING: root@localhost
SNMPv2-MIB::sysName.0 = STRING: helios
SNMPv2-MIB::sysLocation.0 = STRING: Unknown
SNMPv2-MIB::sysORLastChange.0 = Timeticks: (7) 0:00:00.07
SNMPv2-MIB::sysORID.1 = OID: IF-MIB::ifMIB
SNMPv2-MIB::sysORID.2 = OID: SNMPv2-MIB::snmpMIB
SNMPv2-MIB::sysORID.3 = OID: TCP-MIB::tcpMIB
SNMPv2-MIB::sysORID.4 = OID: IP-MIB::ip
SNMPv2-MIB::sysORID.5 = OID: UDP-MIB::udpMIB
SNMPv2-MIB::sysORID.6 = OID: SNMP-VIEW-BASED-ACM-MIB::vacmBasicGroup
SNMPv2-MIB::sysORID.7 = OID: SNMP-FRAMEWORK-MIB::snmpFrameworkMIBCompliance
SNMPv2-MIB::sysORID.8 = OID: SNMP-MPD-MIB::snmpMPDCompliance
SNMPv2-MIB::sysORID.9 = OID: SNMP-USER-BASED-SM-MIB::usmMIBCompliance
SNMPv2-MIB::sysORDescr.1 = STRING: The MIB module to describe generic objects for network interface sub-layers
SNMPv2-MIB::sysORDescr.2 = STRING: The MIB module for SNMPv2 entities
SNMPv2-MIB::sysORDescr.3 = STRING: The MIB module for managing TCP implementations
SNMPv2-MIB::sysORDescr.4 = STRING: The MIB module for managing IP and ICMP implementations
SNMPv2-MIB::sysORDescr.5 = STRING: The MIB module for managing UDP implementations
SNMPv2-MIB::sysORDescr.6 = STRING: View-based Access Control Model for SNMP.
SNMPv2-MIB::sysORDescr.7 = STRING: The SNMP Management Architecture MIB.
SNMPv2-MIB::sysORDescr.8 = STRING: The MIB for Message Processing and Dispatching.
SNMPv2-MIB::sysORDescr.9 = STRING: The management information definitions for the SNMP User-based Security Model.
The program snmpwalk may not be installed on the NPS server because it is a client program. You can install it from the RPMs included on the install media, or run the command
from a remote computer on which it is installed.
The above example was a system overview. Let's say we want to find the MAC address of a remote interface. We can run the snmpwalk to discover the interfaces:
nz@spubox:~$ snmpwalk -v 1 -c testuser spubox interface
IF-MIB::ifNumber.0 = INTEGER: 5
IF-MIB::ifIndex.1 = INTEGER: 1
IF-MIB::ifIndex.2 = INTEGER: 2
IF-MIB::ifIndex.3 = INTEGER: 3
IF-MIB::ifIndex.4 = INTEGER: 4
IF-MIB::ifIndex.5 = INTEGER: 5
IF-MIB::ifDescr.1 = STRING: lo
IF-MIB::ifDescr.2 = STRING: eth0
IF-MIB::ifDescr.3 = STRING: eth1
IF-MIB::ifDescr.4 = STRING: vmnet1
IF-MIB::ifDescr.5 = STRING: vmnet8
IF-MIB::ifType.1 = INTEGER: softwareLoopback(24)
IF-MIB::ifType.2 = INTEGER: ethernetCsmacd(6)
IF-MIB::ifType.3 = INTEGER: ethernetCsmacd(6)
IF-MIB::ifType.4 = INTEGER: ethernetCsmacd(6)
IF-MIB::ifType.5 = INTEGER: ethernetCsmacd(6)
IF-MIB::ifMtu.1 = INTEGER: 16436
IF-MIB::ifMtu.2 = INTEGER: 1500
IF-MIB::ifMtu.3 = INTEGER: 1500
IF-MIB::ifMtu.4 = INTEGER: 1500
IF-MIB::ifMtu.5 = INTEGER: 1500
IF-MIB::ifSpeed.1 = Gauge32: 10000000
IF-MIB::ifSpeed.2 = Gauge32: 100000000
IF-MIB::ifSpeed.3 = Gauge32: 0
IF-MIB::ifSpeed.4 = Gauge32: 10000000
IF-MIB::ifSpeed.5 = Gauge32: 10000000
IF-MIB::ifPhysAddress.1 = STRING:
IF-MIB::ifPhysAddress.2 = STRING: 0:10:18:2d:7e:8f
IF-MIB::ifPhysAddress.3 = STRING: 0:1a:a0:1a:3e:55
IF-MIB::ifPhysAddress.4 = STRING: 0:50:56:c0:0:1
IF-MIB::ifPhysAddress.5 = STRING: 0:50:56:c0:0:8
IF-MIB::ifAdminStatus.1 = INTEGER: up(1)
IF-MIB::ifAdminStatus.2 = INTEGER: up(1)
IF-MIB::ifAdminStatus.3 = INTEGER: up(1)
IF-MIB::ifAdminStatus.4 = INTEGER: up(1)
IF-MIB::ifAdminStatus.5 = INTEGER: up(1)
IF-MIB::ifOperStatus.1 = INTEGER: up(1)
IF-MIB::ifOperStatus.2 = INTEGER: up(1)
IF-MIB::ifOperStatus.3 = INTEGER: down(2)
IF-MIB::ifOperStatus.4 = INTEGER: up(1)
IF-MIB::ifOperStatus.5 = INTEGER: up(1)
IF-MIB::ifInOctets.1 = Counter32: 11292307
IF-MIB::ifInOctets.2 = Counter32: 2224181328
IF-MIB::ifInOctets.3 = Counter32: 0
IF-MIB::ifInOctets.4 = Counter32: 0
IF-MIB::ifInOctets.5 = Counter32: 0
IF-MIB::ifInUcastPkts.1 = Counter32: 59798
IF-MIB::ifInUcastPkts.2 = Counter32: 41997490
IF-MIB::ifInUcastPkts.3 = Counter32: 0
IF-MIB::ifInUcastPkts.4 = Counter32: 0
IF-MIB::ifInUcastPkts.5 = Counter32: 0
IF-MIB::ifInDiscards.1 = Counter32: 0
IF-MIB::ifInDiscards.2 = Counter32: 0
IF-MIB::ifInDiscards.3 = Counter32: 0
IF-MIB::ifInDiscards.4 = Counter32: 0
IF-MIB::ifInDiscards.5 = Counter32: 0
IF-MIB::ifInErrors.1 = Counter32: 0
IF-MIB::ifInErrors.2 = Counter32: 0
IF-MIB::ifInErrors.3 = Counter32: 0
IF-MIB::ifInErrors.4 = Counter32: 0
IF-MIB::ifInErrors.5 = Counter32: 0
IF-MIB::ifOutOctets.1 = Counter32: 11292307
IF-MIB::ifOutOctets.2 = Counter32: 70089618
IF-MIB::ifOutOctets.3 = Counter32: 0
IF-MIB::ifOutOctets.4 = Counter32: 0
IF-MIB::ifOutOctets.5 = Counter32: 0
IF-MIB::ifOutUcastPkts.1 = Counter32: 59798
IF-MIB::ifOutUcastPkts.2 = Counter32: 895251
IF-MIB::ifOutUcastPkts.3 = Counter32: 0
IF-MIB::ifOutUcastPkts.4 = Counter32: 48
IF-MIB::ifOutUcastPkts.5 = Counter32: 48
IF-MIB::ifOutDiscards.1 = Counter32: 0
IF-MIB::ifOutDiscards.2 = Counter32: 0
IF-MIB::ifOutDiscards.3 = Counter32: 0
IF-MIB::ifOutDiscards.4 = Counter32: 0
IF-MIB::ifOutDiscards.5 = Counter32: 0
IF-MIB::ifOutErrors.1 = Counter32: 0
IF-MIB::ifOutErrors.2 = Counter32: 0
IF-MIB::ifOutErrors.3 = Counter32: 0
IF-MIB::ifOutErrors.4 = Counter32: 0
IF-MIB::ifOutErrors.5 = Counter32: 0
IF-MIB::ifOutQLen.1 = Gauge32: 0
IF-MIB::ifOutQLen.2 = Gauge32: 0
IF-MIB::ifOutQLen.3 = Gauge32: 0
IF-MIB::ifOutQLen.4 = Gauge32: 0
IF-MIB::ifOutQLen.5 = Gauge32: 0
IF-MIB::ifSpecific.1 = OID: SNMPv2-SMI::zeroDotZero
IF-MIB::ifSpecific.2 = OID: SNMPv2-SMI::zeroDotZero
IF-MIB::ifSpecific.3 = OID: SNMPv2-SMI::zeroDotZero
IF-MIB::ifSpecific.4 = OID: SNMPv2-SMI::zeroDotZero
IF-MIB::ifSpecific.5 = OID: SNMPv2-SMI::zeroDotZero
snmpwalk provides information about five interfaces found on this system. Let's say we want to find the MAC address of eth0. Use the snmpget command which requires syntax similar to snmpwalk:
nz@spubox:~$ snmpget -v 1 -c testuser spubox0 ifPhysAddress.2
IF-MIB::ifPhysAddress.2 = STRING: 0:10:18:2d:7e:8f
We can confirm this by logging in to the server and running ifconfig on eth0:
[root@spubox ~]# ifconfig eth0
eth0 Link encap:Ethernet HWaddr 00:10:18:2D:7E:8F
inet addr:172.29.82.34 Bcast:172.29.83.255 Mask:255.255.252.0
UP BROADCAST RUNNING MULTICAST MTU:1500 Metric:1
RX packets:42004046 errors:0 dropped:0 overruns:0 frame:0
TX packets:895498 errors:0 dropped:0 overruns:0 carrier:0
collisions:0 txqueuelen:1000
RX bytes:2224896743 (2.0 GiB) TX bytes:70121447 (66.8 MiB)
Interrupt:169
How can this information be used? You can use a program like MRTG to grab this SNMP info and use it for monitoring bandwidth of interfaces. The following command adds the spubox server to the MRTG config so that it can report how much data is passing to it.
nz@spubox:/etc$ sudo cfgmaker --output=/etc/mrtg.cfg --global "workdir: /var/www/mrtg" -ifref=ip --global 'options[ ]: growright,bits' testuser@spubox
Although SNMP configuration can be tricky, this article should get you started. As you learn more, you can make the configuration file reflect what you are doing with data, who you want to have access to it, etc. When you are ready, you can move the snmp.conf.old file back to snmp.conf and replace the community string - giving you a default working configuration for your NPS system.
Historical Number
NZ410558
Was this topic helpful?
Document Information
Modified date:
17 October 2019
UID
swg21570793