2009-02-10

How to Force Collection of Interface Stats in NMIS

So today I figured out how to explicitly set an interface alias in NMIS. We have a Force10 C300 switch and NMIS was able to discover all the interfaces via SNMP just fine. The problem was that NMIS is configured to only collect information from interfaces that have the description set. Even though we set the description on our interfaces, for some reason it wasn't treating it the same way as, for instance, a Cisco switch. In any case, after a few minutes of reading the documentation I figured out that the NMIS author already thought of this potential problem and supplied a work-around. It's called sysInterface. Basically, you populate a tab-delimited CSV file with entries like this:

# THE FIRST LINE NON COMMENT IS THE HEADER LINE AND REQUIRED

Description Node Overwrite_Description ifIndex ifSpeed
192.168.0.1 ^f10-c300$ 1 100975616 null
192.168.0.2 ^f10-c300$ 1 107529216 null


So the node is a regular expression of the switch (or router or whatever) you want it to act on, as is the ifIndex. I just snmpwalked the switch to figure out all the indexes and came out with a list of switch port numbers (like GigabitEthernet 0/0) and OID indexes. Then I cross-referenced that with another list I had with the switch port numbers and the host IP address to come up with the final CSV. The Overwrite_Description field is a boolean, set it to 1 (or maybe even true, I haven't tried that) and it will activate the interface description overrride. Leave ifSpeed blank (or null rather) as it will just get the correct value from SNMP. Also, if you don't have the list of host names or IP addresses you want to use for the Description field, just use the keyword ifDescr and it will just copy whatever the "hardware label" is (that's like GigabitEthernet 0/0 or whatever).

So once you do that, you just run nmis.pl type=update debug=true and you should see the overwritten ifAliases and collect will be forced to true. Yay.

No comments: