On Sun, 24 Apr 2005 00:16:04 -0700, Jeff Liebermann
<(E-Mail Removed)> wrote:
>On 23 Apr 2005 10:54:12 -0700, "tomviolin"
><(E-Mail Removed)> wrote:
>
>>What I would like to do is create a Perl script to periodically perform
>>a link test on a Cisco 350 bridge and record the current signal
>>strength. I'm doing this as part of a site survey.
Duh... Extracted from my own MRTG install instructions is this script
that will return the uptime from a router. I use it for testing SNMP.
Change the host name to the Cisco router, the community name, and the
OID to whatever is the OID for signal strength.
You'll need to get BER.PM and SNMP_SESSION.PM from either the MRTG
distribution, or the latest from:
http://www.switch.ch/misc/leinen/snmp/perl/dist/
use BER;
use SNMP_Session;
# Return the uptime of the localhost to test SNMP
$host = "localhost";
$community = "public";
$oid = encode_oid(1,3,6,1,2,1,1,3,0); # Uptime
$session = SNMP_Session->open ($host, $community, 161)
|| die "Can't open SNMP session to localhost";
$session->get_request_response ($oid);
($bindings) = $session->decode_get_response ($session->{pdu_buffer});
($binding,$bindings) = &decode_sequence ($bindings);
($oid,$value) = &decode_by_template ($binding, "%O%@");
print &pretty_print($oid)," => ", &pretty_print ($value), "\n";
--
Jeff Liebermann
(E-Mail Removed)
150 Felker St #D
http://www.LearnByDestroying.com
Santa Cruz CA 95060 AE6KS 831-336-2558