SysMan Mall

« SNMPv3 in Sun MC... | Main | Understanding Report... »

http://blogs.sun.com/adikhit/date/20061013 Friday October 13, 2006

Enabling/ Disabling rows in an SNMP table


Enabling/ disabling a row can be done in SunMC 3.6/3.6.1 environment by directly communicating with the agent if you have access to SNMP utilities that support v3 operations (Note in SunMC world, v1 & v2c requests can not modify info. unless granted privileges on a module which by default is restricted to read only)

To make use of SNMP operations, one requires configuring an SNMPv3 user on the agent using es-config tool and granting authorization (setting correct ACLs) on a module. For the purpose of this exercise it is assumed a correctly configured user on SunMC agent who is using SNMP utilities on an S10 system to talk to the target agent. To do anything meaningful first of all $HOME/.snmp/snmp.conf is created with following values (the file should be guarded with correct protection to ensure password safety,  something like 400 permission on the file containing sensitive information)

$ cat $HOME/.snmp/snmp.conf
defVersion 3
defSecurityName v3user
defPassphrase v3userpass
defAuthType MD5
defSecurityLevel authNoPriv

For more information on these parameters check man of snmp.conf on a Solaris 10 system.

Next we need to know the OID of node with syntax RowStatus inside the table of interest. For example rowstatus node in  Scan table of fscan module has an OID value of "1.3.6.1.4.1.42.2.12.2.2.24.1.3.1.1". The file scan module is a multi-instance module and therefore,  has an instance name which we are assuming to be  "syslog". While using S10/net-snmp utility snmpwalk/ get/set  we'll have to specify request's context as "syslog" for the query to work correctly. All the above leads to following command

$ snmpwalk  -n syslog <hostname> 1.3.6.1.4.1.42.2.12.2.2.24.1.3.1.1

The output will look something similar depending on what rows are there in the target agent's environment

SNMPv2-SMI::enterprises.42.2.12.2.2.24.1.3.1.1.9.117.110.105.120.95.119.97.114.110 = INTEGER: 2
SNMPv2-SMI::enterprises.42.2.12.2.2.24.1.3.1.1.10.100.105.115.107.95.101.114.114.111.114 = INTEGER: 1
SNMPv2-SMI::enterprises.42.2.12.2.2.24.1.3.1.1.10.102.109.97.95.99.112.117.109.101.109 = INTEGER: 1
SNMPv2-SMI::enterprises.42.2.12.2.2.24.1.3.1.1.10.116.97.112.101.95.101.114.114.111.114 = INTEGER: 1
SNMPv2-SMI::enterprises.42.2.12.2.2.24.1.3.1.1.10.117.110.105.120.95.101.114.114.111.114 = INTEGER: 1
SNMPv2-SMI::enterprises.42.2.12.2.2.24.1.3.1.1.12.107.101.114.110.101.108.95.101.114.114.111.114 = INTEGER: 1
SNMPv2-SMI::enterprises.42.2.12.2.2.24.1.3.1.1.15.114.111.111.116.95.108.111.103.105.110.95.102.97.105.108 = INTEGER: 1


Note the OID following 1.3.6.1.4.1.42.2.12.2.2.24.1.3.1.1 is the index of the entry in the table. The index value is further split into length of index and an ASCII value string. For example the first index value "9.117.110.105.120.95.119.97.114.110" can be split into length of index (9) and the ascii value of index string (117.110.105.120.95.119.97.114.110).

Given the above description it follows that 9 is the length of index and "unix_warn" is the index string we have picked up here.

A value of 1 indicates an "on/enabled" status for the row and a value of "2" indicates an "off/disabled" status for the row (or notInService in SNMP RowStatus primitive parlance). Enabling/ Disabling a row is simply toggling the value of rowstatus node in a table, which in turn changes the string value for node "State" to "On/Off" in case of SunMC file scan module. To clarify this further "State" and "rowstatus" are two different nodes, modifying value of "rowstatus" triggers an update of node "State".

To enable the above mentioned row run snmpset  command as shown:

$ snmpset -n syslog <hostname> SNMPv2-SMI::enterprises.42.2.12.2.2.24.1.3.1.1.9.117.110.105.120.95.119.97.114.110 i 1
SNMPv2-SMI::enterprises.42.2.12.2.2.24.1.3.1.1.9.117.110.105.120.95.119.97.114.110 = INTEGER: 1

The previous value of "2" or "off" (notInService) as a result of the above set is modified to "1" or "on" (Active in SNMP terminology).

The other values possible for this node are 3 (notReady), 4 (createAndGo), 5 (createAndWait) and 6 (Destroy) and can be used as required.

In general to create a new row all fields that make up the conceptual row must be  specified. In case of SunMC agent fields in a table can be tagged as required while defining the module, therefore, must be specified at row creation time. Rest of the fields can be given a default value which will allow creation of row to progress in an easier fashion.

Comments:

Post a Comment:
  • HTML Syntax: NOT allowed

Valid HTML! Valid CSS!

This is a personal weblog, I do not speak for my employer.