4

I try to create a custom SNMP oid (and script).

I add the following line to snmpd.conf (and restart service) :

pass .1.3.6.1.3.2 /bin/myscript.sh

.

cat myscript.sh
#!/bin/sh
echo .1.3.6.1.3.2
echo gauge
exec 100

.

snmpwalk -c mycommunity -v2c 10.2.1.4 .1.3.6.1.3.2
SNMPv2-SMI::experimental.2 = Gauge32: 100
Error: OID not increasing: SNMPv2-SMI::experimental.2
>= SNMPv2-SMI::experimental.2

Is snmpwalk expecting anything at the end of the query ? snmpget work with no problem!

amprantino
  • 1,597
  • 4
  • 15
  • 15

2 Answers2

5

By default snmpwalk expect the value to be increasing. To get around it try:

snmpwalk -Cc -c mycommunity -v2c 10.2.1.4 .1.3.6.1.3.2

The Cc option does this: "do not check returned OIDs are increasing"

Often the walk can be completed with oid:s out of order using this.

SpacemanSpiff
  • 249
  • 7
  • 17
2

snmpwalk expects increasing replies :

SNMPv2-SMI::experimental.2 = Gauge32: 100
SNMPv2-SMI::experimental.3 = Gauge32: 1125
SNMPv2-SMI::other.1 = Gauge32: 10
END

It appears that the snmp agent replies two identical values :

SNMPv2-SMI::experimental.2 = Gauge32: 100
SNMPv2-SMI::experimental.2 = Gauge32: 100

So it fails (unexpected behaviour).

JB.
  • 1,103
  • 1
  • 20
  • 37