I am picking up Net::SNMP and have a simple script that worked fine while VPN'd in to work from home. Then I come in this morning (having made zero changes) and now I get the error that the host isn't responding (but I can ping it). I checked my firewall, and it's not blocking the traffic. I've seen posts on the 'net where people had to modify *nix config files, but I'm on Windoze using ActivePerl. The latest version of Net::SNMP that was available is what I'm using (6.0). Any ideas? Code below:
Thanks,
Scott
#!c:/perl/bin/perl
use strict;
use warnings;
use Net::SNMP;
my $OID = '1.3.6.1.4.1.9.9.513.1.1.1.1.2.0.23.223.167.189.192';
#my $OID = '1.3.6.1.4.1.9.9.513.1.1.1.1.2';
my ($session, $error) = Net::SNMP->session(
-hostname => '10.100.10.4',
-version => 'snmpv2c',
-community => 'private'
);
if (!defined $session) {
printf "ERROR: %s.\n", $error;
exit 1;
}
my $result = $session->get_request(-varbindlist => [ $OID ],);
#my $result = $session->get_bulk_request(-varbindlist => [ $OID ],);
if (!defined $result) {
printf "ERROR: %s.\n", $session->error();
$session->close();
exit 1;
}
print "$result->{$OID}\n";
foreach my $key ( sort keys %$result ) {
print "$key => $$result{$key}\n";
}
$session->close();
Posts are HTML formatted. Put <p> </p> tags around your paragraphs. Put <code> </code> tags around your code and data!
Titles consisting of a single word are discouraged, and in most cases are disallowed outright.
Read Where should I post X? if you're not absolutely sure you're posting in the right place.
Please read these before you post! —
Posts may use any of the Perl Monks Approved HTML tags:
- a, abbr, b, big, blockquote, br, caption, center, col, colgroup, dd, del, details, div, dl, dt, em, font, h1, h2, h3, h4, h5, h6, hr, i, ins, li, ol, p, pre, readmore, small, span, spoiler, strike, strong, sub, summary, sup, table, tbody, td, tfoot, th, thead, tr, tt, u, ul, wbr
You may need to use entities for some characters, as follows. (Exception: Within code tags, you can put the characters literally.)
|
For: |
|
Use: |
| & | | & |
| < | | < |
| > | | > |
| [ | | [ |
| ] | | ] |
Link using PerlMonks shortcuts! What shortcuts can I use for linking?
See Writeup Formatting Tips and other pages linked from there for more info.
|
|