DJViking
DJViking

Reputation: 872

Multiple values with snmpset using Net-SNMP

Lately asking on the Net-SNMP mailing list is like winning the lottery, i.e. it never happens.

I need to know how I can set multiple parameter values with snmpset for my command scalars?

I have implemented my commands as simple scalars, but lately I was thinking perhaps I needed to implement them as tables since they can have multiple parameters.

When setting/triggering such a command with snmpset, the choice is no parameters, one parameter or multiple parameters.

Given the following example MIB for table. Lets say it is one of my commands. Apparently write-only is no longer allowed in SMIv2, so I have used not-accessible. These commands are not to be accessed by snmpget.

netSnmpHostsTable OBJECT-TYPE
  SYNTAX      SEQUENCE OF NetSnmpHostsEntry
  MAX-ACCESS  not-accessible
  STATUS      current
  DESCRIPTION
      "An example table that implements a wrapper around the 
      /etc/hosts file on a machine using the iterator helper API."
  ::= { netSnmpExampleTables 2 }

netSnmpHostsEntry OBJECT-TYPE
    SYNTAX      NetSnmpHostsEntry
    MAX-ACCESS  not-accessible
    STATUS      current
    DESCRIPTION
        "A host name mapped to an ip address"
    INDEX   { netSnmpHostName }
::= { netSnmpHostsTable 1 }

NetSnmpHostsEntry ::= SEQUENCE {
    netSnmpHostName         OCTET STRING,
    netSnmpHostAddressType  OCTET STRING,
    netSnmpHostAddress      OCTET STRING
}

netSnmpHostName OBJECT-TYPE
    SYNTAX      OCTET STRING (SIZE(0..64))
    MAX-ACCESS  not-accessible
    STATUS      current
    DESCRIPTION
        "A host name that exists in the /etc/hosts (unix) file."
::= { netSnmpHostsEntry 1 }

netSnmpHostAddressType OBJECT-TYPE
    SYNTAX      OCTET STRING (SIZE(0..64))
    MAX-ACCESS  not-accessible
    STATUS      current
    DESCRIPTION
        "The address type of then given host."
::= { netSnmpHostsEntry 2 }

netSnmpHostAddress OBJECT-TYPE
    SYNTAX      OCTET STRING (SIZE(0..64))
    MAX-ACCESS  not-accessible
    STATUS      current
    DESCRIPTION
        "The address of then given host."
::= { netSnmpHostsEntry 3 }


Calling with no parameters
snmpset netSnmpHostsTable.0
or calling with 3 parameters
snmpset netSnmpHostsTable.1 something netSnmpHostsTable.2 something else netSnmpHostsTable.3 something more

Is that possible with snmpset? When setting multiple rows with snmpset will it process it as one request or multiple requests?

Upvotes: 1

Views: 3698

Answers (1)

martski
martski

Reputation: 342

Not-accessible means exactly that, you won't be able to set, get or even see these in a walk, as they are not-accessible ie they are nodes defining structure only.

You'll probably have to use read-write, or read-create if your table will have an entry status to add rows, I don't know why write-only has gone, it makes sense for some things.

In answer to the question yes, a command like:

C:\net-snmp\bin\snmpset -v 2c -c public -M +C:\mibs -m SOME-MIB 10.20.30.40 SOME-MIB::someString.9 = "martski"  SOME-MIB::someOtherString.9 = "http://waratah.webs.com/" SOME-MIB::someEntryStatus.9 = createAndGo

Upvotes: 2

Related Questions