Improving Nexenta SNMP daemon

Nexenta has SNMP capability. Configured from the Web interface, you can set the various communities for SNMP version. But there is more. You can improve it a lot using the Nexenta Management Console (NMC).

Here’s what you get from the default SNMP daemon:

# snmpwalk -c public -v 2c nexenta.tumfatig.net system SNMPv2-MIB::sysDescr.0 = STRING: NexentaOS SNMPv2-MIB::sysObjectID.0 = OID: SNMPv2-SMI::org SNMPv2-MIB::sysUpTime.0 = Timeticks: (6172) 0:01:01.72 SNMPv2-MIB::sysContact.0 = STRING: Root <root@example.org> SNMPv2-MIB::sysName.0 = STRING: nexenta SNMPv2-MIB::sysLocation.0 = STRING: Huge Data Center

The first option to properly configure community is the Web interface. The second one is the NMC:

nmc@nexenta:/$ setup network service snmp-agent configure Read-only community string : secret Read-write community string : secret User name for SNMPv3 agent : secret Password for SNMPv3 agent. Must be at least 8 characters long : secret00 Destination of SNMP-traps : localhost

From there, the community values have be set ; of course “secret” is not a good community string. But the system information are still not correct. Let’s edit the SNMPd configuration file by hand:

nmc@nexenta:/$ setup network service snmp-agent edit-settings snmpd.conf (...) sysLocation Paris, France sysContact Joel Carnat <ptijo@tumfatig.net> (...) Re-read 'snmp-agent' service configuration? Yes

The snmpd has been reloaded and you now have the updated information available:

# snmpwalk -c secret -v 2c nexenta system SNMPv2-MIB::sysDescr.0 = STRING: NexentaOS SNMPv2-MIB::sysObjectID.0 = OID: SNMPv2-SMI::org SNMPv2-MIB::sysUpTime.0 = Timeticks: (2218) 0:00:22.18 SNMPv2-MIB::sysContact.0 = STRING: Joel Carnat <ptijo@tumfatig.net> SNMPv2-MIB::sysName.0 = STRING: nexenta SNMPv2-MIB::sysLocation.0 = STRING: Paris, France

Tada!!! But wait, there is more…
As every decent snmpd implementation, you can extend Nexenta snmp daemon.
Have a look at `help snmpd.conf` for more information.

For further monitoring purpose, we are going to improve SNMPd so that we can remotely get the CPU times:

nmc@nexenta:/$ setup network service snmp-agent edit-settings snmpd.conf (...) extend cputime /root/scripts/cputime

Now we need to create the script that will be run by snmpd:

nmc@nexenta:/$ options expert_mode=1 nmc@nexenta:/$ !bash # mkdir /root/scripts # vi /root/scripts/cputime #!/usr/bin/env bash # # Display CPU activity time dispatch # PATH=/bin:/usr/bin:/sbin:/usr/sbin vmstat 1 3 | \ awk 'END { print "us: " $(NF-2) "\nsy " $(NF-1) "\nid: " $NF }' exit 0

The information can now be pooled from the monitoring server using the proper snmpcmd:

# snmpwalk -c secret -t 5 -v 2c nexenta 'NET-SNMP-EXTEND-MIB::nsExtendOutLine."cputime"' NET-SNMP-EXTEND-MIB::nsExtendOutLine."cputime".1 = STRING: us: 0 NET-SNMP-EXTEND-MIB::nsExtendOutLine."cputime".2 = STRING: sy 1 NET-SNMP-EXTEND-MIB::nsExtendOutLine."cputime".3 = STRING: id: 99

Note the “-t 5” parameters that is required to increase timeout (used by vmstat).
The various CPU times can now be fetched (and graphed) from any good monitoring tool. You can do the same thing for Memory, Temperature of ZFS status.

Hope this helps!

No Comments

Leave a Reply

%d bloggers like this: