SNMPSET(1)

πŸ’– SNMPSET(1) πŸ’–

okay so bestie, welcome to SNMPSET from the Net-SNMP fam β€” this is the one that writes, not just reads. buckle up πŸŽ€


✨ NAME ✨

snmpset β€” talks to a network entity using SNMP SET requests 🫢


🌸 SYNOPSIS 🌸

snmpset [COMMON OPTIONS] AGENT OID TYPE VALUE [OID TYPE VALUE]...

πŸ¦‹ DESCRIPTION πŸ¦‹

so snmpset is an SNMP application that uses the SNMP SET request to actually set information on a network entity. like, you're not just peeking anymore, you're changing stuff. main character energy fr πŸ’…

you gotta give it one or more object identifiers (OIDs) as arguments on the command line β€” that's non-negotiable. and every single object identifier has to come with a type and a value to be set, like a little trio walking in together. each variable name is written in the format that's spelled out in variables(5).

the TYPE is one single character, and here's the whole squad πŸ‘‘:

  • i β€” INTEGER
  • u β€” UNSIGNED
  • s β€” STRING
  • x β€” HEX STRING
  • d β€” DECIMAL STRING
  • n β€” NULLOBJ
  • o β€” OBJID
  • t β€” TIMETICKS
  • a β€” IPADDRESS
  • b β€” BITS

most of these will use the obvious corresponding ASN.1 type, no surprises. but listen β€” s, x, d and b are all different ways of specifying an OCTET STRING value, and the u unsigned type is also what handles Gauge32 values. iykyk 😌

now, if you have the proper MIB file loaded, you can, in most cases, replace the type with an = sign instead. for an object of type OCTET STRING it'll assume a string, just like the s type notation does. for other types it'll do "The Right Thing". iconic behavior honestly.

for example:

snmpset -c private -v 1 test-hub system.sysContact.0 s
dpz@noc.rutgers.edu ip.ipforwarding.0 = 2

this will set the variables sysContact.0 and ipForwarding.0:

system.sysContact.0 = STRING: "dpz@noc.rutgers.edu"
ip.ipForwarding.0 = INTEGER: not-forwarding(2)

and if the network entity has an error processing the request packet, an error packet will be returned and a message will be shown β€” which helps you pinpoint exactly in what way the request was malformed. not me getting a lil error message to tell me what i did wrong 😭 so helpful tho.


πŸ’… OPTIONS πŸ’…

snmpset takes the common options described in the snmpcmd(1) manual page. go read that one, bestie, it's the shared lore ✨

⚠️ heads up: snmpset REQUIRES an argument specifying the agent to query, and at least one set of OID/type/value arguments, exactly as described in there. no agent, no set. periodt.

🌈 SEE ALSO 🌈


and that's the whole thing, babe 🧚 from Net-SNMP, version V5.9.5.2, dated 19 Jun 2003 β€” yeah she's an elder but she still ate πŸ’– go set some OIDs, you got this πŸ‘‘πŸ¦‹

πŸ“¦ where this page comes from