http://www.perlmonks.org?node_id=950838


in reply to SNMP set request

Use Net::SNMP:

#! /usr/bin/perl use strict; use warnings; use Net::SNMP qw(:ALL); my ($session, $error) = Net::SNMP->session( -hostname => '10.10.10.1', -version => 1, -community => 'public', ); my $result = $session->set_request( -varbindlist => [ '1.3.6.1.4.1.50000.1.1', INTEGER, 1, '1.3.6.1.4.1.50000.1.2', INTEGER, 2 ] ); $session->close();

And the 'tcpdump' capture verifies both OID integers set in the same packet.

tcpdump: listening on \Device\NPF_{731EA781-5FB3-4C71-944A-D70C7EE18AA +7} 15:54:50.646616 c4:17:fe:12:7d:75 > 58:6d:8f:78:ad:40, ethertype IPv4 +(0x0800), length 105: (tos 0x0, ttl 128, id 2841, offset 0, flags [none], proto: + UDP (17), length: 91) 192.168.10.100.52184 > 10.10.10.1.161: [udp sum ok] { SN +MPv1 { Set Request(48) R=1833500672 .1.3.6.1.4.1.50000.1.1=1 .1.3.6.1.4.1.50000. +1.2=2 } } 0x0000: 586d 8f78 ad40 c417 fe12 7d75 0800 4500 Xm.x.@....}u..E. 0x0010: 005b 0b19 0000 8011 5062 c0a8 0a64 0a0a .[......Pb...d.. 0x0020: 0a01 cbd8 00a1 0047 4b23 303d 0201 0004 .......GK#0=.... 0x0030: 0670 7562 6c69 63a3 3002 046d 4900 0002 .public.0..mI... 0x0040: 0100 0201 0030 2230 0f06 0a2b 0601 0401 .....0"0...+.... 0x0050: 8386 5001 0102 0101 300f 060a 2b06 0104 ..P.....0...+... 0x0060: 0183 8650 0102 0201 02 ...P.....