Beefy Boxes and Bandwidth Generously Provided by pair Networks
No such thing as a small change

Re: Perl Net::SNMP returns 1 instead of the desired outcome

by Khen1950fx (Canon)
on Oct 25, 2013 at 19:18 UTC ( #1059735=note: print w/replies, xml ) Need Help??

in reply to Perl Net::SNMP returns 1 instead of the desired outcome

I used snmpv1, blocking, and printf instead of print; also, I added DEBUG_ALL to make it more interesting:
# /usr/bin/perl use strict; use warnings; use Net::SNMP qw(:snmp DEBUG_ALL); my $OID = ''; my ( $session, $error ) = Net::SNMP->session( -hostname => shift || 'localhost', -community => shift || 'public', -version => 'snmpv1', -debug => DEBUG_ALL, ); my $result = $session->get_request( -varbindlist => [$OID], ); if ( !defined $result ) { $error = $session->error(); printf "GET_REQUEST ERROR: %s: %s\n", $session->error(); $session->close(); exit(1); } printf "The TimeTicks for host '%s' is %s\n", $session->hostname(), $result->{$OID}, "\n"; $session->close; exit(0);

Log In?

What's my password?
Create A New User
Node Status?
node history
Node Type: note [id://1059735]
LanX ... uhm ... wait...
[Eily]: LanX I don't see the woman
[LanX]: at the right, tanned , gib boobs, chains
[LanX]: big
[Your Mother]: That show, in hindsight, is terribly ominous... playing apologist and glorifier for Vietnam vets. Attempting to neuter violence as a valid tool where no one ever really gets hurt...
[Your Mother]: I wonder just how much that single show influenced the severe cognitive dissonance of my generation in the US.
[LanX]: A Team or McG ?
[Your Mother]: A-Team.

How do I use this? | Other CB clients
Other Users?
Others exploiting the Monastery: (13)
As of 2018-03-19 14:47 GMT
Find Nodes?
    Voting Booth?
    When I think of a mole I think of:

    Results (240 votes). Check out past polls.