5 Little known SNMP secrets of the experts

Simple Network Management Protocol (SNMP) is one of the widely used management protocol. SNMP has gained a huge advantage due to its ease of data retrieval and efficient use of network bandwidth. This blog aims to cover certain key points in SNMP (version 1 & 2c). Some of these points are not explicitly said in the SNMP RFC. Hope the concepts discussed will be a good learning experience to you

1. GetNext for SysName is SysName.0

SNMP Protocol Data Unit (PDU) “GetNext” is used to get lexicographically next managed object from the Management Information Base (MIB). One could wrongly conclude that “GetNext” of SysName is SysLocation on a glance through the MIB (here). However Figure 1 displays the actual result.

Figure 1 - GetNext
Figure 1 – GetNext

As shown, sysName.0 is lexicographically next to sysName. So even though sysName is leaf object only sysName.0 will have a value. So, GetNext will end up in getting sysName.0 and not sysLocation. This concept applies to any scalar object.

Note: Scalar objects are those that that have only one instance.

2. Tabular instances starts from 1 however Scalar instances start from 0

The index for tabular objects, objects that have multiple instances, starts from 1. However index for scalar objects, objects that have only instance, starts from 0 (off course ends at 0 itself;)). Figure 2 displays the output of ifIndex (tabular) and sysName (scalar) managed objects.

Figure 2 - Tabular (vs) scalar instances
Figure 2 – Tabular (vs) scalar instances

Henceforth, only snmpget on sysName.0 will return a value and snmpget on sysName will return an error.

3. RowStatus automatically moves to Active after successful creation

SNMP Version 2c defines a way to create a new row in a table. A new row can be created in tables that has a column of type ROWSTATUS. A new row can be created by giving values for all mandatory columns and setting ROWSTATUS column to “CreateAndGo(4)”. This will create a new row. If values for all mandatory columns are proper the ROWSTATUS value will be moved to “Active(1)”. However in certain cases, administrator needs to make a row active after certain period of time, say for cases like configuration changes. In such cases user needs to create row(s) with ROWSTATUS value as “CreateAndWait(5)”.  This will move the ROWSTATUS to “NotReady” or “NotInService” depending upon the value for other mandatory columns. As per the administrator intent, the row can be made active by setting the ROWSTATUS value to Active (1) at any point of time.

4. Error Index and Error Status are always set to zero (0) in SNMPV2c

SNMP version 2c is atomic, i.e. user will be able to get results for partial set of varbinds. In case of SNMP version 1, error will be returned when certain varbinds are wrong. A query made using SNMP version 1 and version 2c are as shown in Figure 3 and Figure 4

Figure 3 - Using SNMP V1
Figure 3 – Using SNMP V1

Figure 4 - Using SNMP v2c
Figure 4 – Using SNMP v2c

In case of SNMP version 1 Error Status and Error Index value will be updated properly*. However in SNMP version 2c these values are always set to zero (0) in response even in case of errors. So any assumption made in manager (NMS/EMS) based on these values will end up wrongly.

*Note:

  1. Error Status will indicate the type of error and Error Index will indicate the first varbinds that caused this error. (applicable only to SNMP v1)
  2. NMS – Network Management System
  3. EMS – Element Management System

5. ifIndex re-usage is agent specific

IfTable is used to get the details about interfaces. This table is indexed using ifIndex, a unique index assigned to each interfaces. Reusing the ifIndex on swapping/removing of an interface is specific to agent implementation. For example, when user replaces an interface gi1/1 having ifIndex 10 with other interface say TenGig1/1, the new interface TenGig1/1 is not guaranteed to use the same ifIndex, 10.

Thanks to @surendrakumar for confirming TIP 5

Add to FacebookAdd to NewsvineAdd to DiggAdd to Del.icio.usAdd to StumbleuponAdd to RedditAdd to BlinklistAdd to TwitterAdd to TechnoratiAdd to Furl

Advertisements

2 Responses

  1. Good tech notes, veerabahu.

  2. “However in SNMP version 2c these values are always set to zero (0) in response even in case of errors. So any assumption made in manager (NMS/EMS) based on these values will end up wrongly.”

    (I guess) this is wrong — in case if you end up in a toobig error, even in snmpv2c, the error index will be 0 but you will have error status set to ‘too big’ .. so always the NMS has to parse the error-status/error-index for these kind of errors/exceptions.

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s

%d bloggers like this: