<?xml version="1.0" encoding="windows-1252"?>
<node id="9402" title="snmping.pl" created="2000-04-27 14:08:04" updated="2005-08-11 11:22:28">
<type id="1748">
sourcecode</type>
<author id="8943">
ergowolf</author>
<data>
<field name="doctext">
&lt;CODE&gt;
use BER;
require 'SNMP_Session.pm';

my $host = @ARGV[0];
my $community = public;
my $port = 161;

$session = SNMP_Session-&gt;open ($host, $community,
$port) || die "couldn't open SNMP session to $host";

$oid1 = encode_oid (1, 3, 6, 1, 2, 1, 1, 1, 0);

if ($session-&gt;get_request_response ($oid1)) {
($bindings) = $session-&gt;decode_get_response
($session-&gt;{pdu_buffer});

        while ($bindings ne '') {
        ($binding,$bindings) = &amp;decode_sequence ($bindings);
        ($oid,$value) = &amp;decode_by_template ($binding,
"%O%@");
        print $pretty_oids{$oid}," =&gt; ",
        &amp;pretty_print ($value), "\n";
        }
} else {
die "No response from agent on $host";
}
&lt;/CODE&gt;</field>
<field name="codedescription">
This program is GREAT for testing snmp and discovering the
community name for the device.</field>
<field name="codecategory">
network management</field>
<field name="codeauthor">
ergowolf</field>
</data>
</node>
