Skip to content

[RFE] Support more SNMP value types for SET command #12

@Runekeon

Description

@Runekeon

The net-snmp site shows

 type - one of i, u, t, a, o, s, x, d, n
    i: INTEGER, u: unsigned INTEGER, t: TIMETICKS, a: IPADDRESS
    o: OBJID, s: STRING, x: HEX STRING, d: DECIMAL STRING
    U: unsigned int64, I: signed int64, F: float, D: double

but the help for snmpset.py is missing x: HEX STRING, d: DECIMAL STRING, F: float, and D: double

Management parameters:
   <[mib-module::]object-name|oid type| = value> ...
              mib-module:           MIB name (e.g. SNMPv2-MIB)
              object-name:          MIB symbol (e.g. sysDescr.0) or OID
              type:                 MIB value type
                    i               integer
                    u               unsigned integer
                    s               string
                    n               NULL
                    o               ObjectIdentifier
                    t               TimeTicks
                    a               IP address
              =:                    use MIB for value type lookup
              value:                value to write

For my team we use sets of x type daily like this

$ snmpget -v2c -r1 -c <community string> udp6:2001:558:4033:59:4a1d:70ff:fe65:691d .1.3.6.1.2.1.69.1.3.7.0
SNMPv2-SMI::mib-2.69.1.3.7.0 = Hex-STRING: BA DB AD BA DB AD BA DB AD BA DB AD BA DB AD 00 
$ snmpset -v2c -r1 -c <community string> udp6:2001:558:4033:59:4a1d:70ff:fe65:691d .1.3.6.1.2.1.69.1.3.7.0 x "FE 80 CD 00 00 00 0C DE 12 57 00 00 21 1E 72 9C"
SNMPv2-SMI::mib-2.69.1.3.7.0 = Hex-STRING: FE 80 CD 00 00 00 0C DE 12 57 00 00 21 1E 72 9C 
$ snmpget -v2c -r1 -c <community string> udp6:2001:558:4033:59:4a1d:70ff:fe65:691d .1.3.6.1.2.1.69.1.3.7.0
SNMPv2-SMI::mib-2.69.1.3.7.0 = Hex-STRING: FE 80 CD 00 00 00 0C DE 12 57 00 00 21 1E 72 9C 
$ 

We use the others rarely but there can be cases for them.
Is there a reason the snmpclitools doesn't support the other types?

Metadata

Metadata

Assignees

No one assigned

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions