0

Having a problem. I need to use snmpset in lua, so I use the luasnmp module.

When I tried that I get one error messages that say: "snmp: bad type (2) prim=0 in index 1"

But it is ok by using net-snmp snmpset by bash.

Has anybody any experience (or advice / where we should look) with this ? Thanks

Here is the script:

local snmp = require "snmp"

hub1, err = snmp.open{
  peer = "1.1.1.1", 
  community = "private", 
}
assert(hub1, err)

vbIn = {
  {oid = ".1.3.6.1.4.1.9.9.16.1.1.1.16.333", type = NUMBER, value = 6 },
}
vbOut, err = assert(hub1:set(vbIn))
ms2008
  • 362
  • 4
  • 19

1 Answers1

0
 type = NUMBER

seems strange. did you mean

 type = 'NUMBER'

or

 type = snmp.NUMBER

? i guess print(NUMBER) will say 'nil'

lipp
  • 5,586
  • 1
  • 21
  • 32
  • if so, you may write snmp.NUMBER... just make print(NUMBER) just before vbIn = ... – lipp Oct 24 '12 at 12:02
  • ok, so NUMBER is problably not what you want. where did you take this (example) from? i still think, it should be something like snmp.NUMBER, i am not familiar with this module though. maybe you can juts leave out the type field and let lua / the binding guess it? – lipp Oct 24 '12 at 13:10
  • I found it on the luasnmp site. It is this: "type = snmp.TYPE_INTEGER", and it's works fine on cisco platform. But when I perform it on a H3C(a chinese company) platform, it failed and get the error: "snmp: timeount" But it works well using net-snmp snmpset. Do you know the resaon? – ms2008 Oct 25 '12 at 09:28