MacScissor has asked for the wisdom of the Perl Monks concerning the following question:
Hello monks!
I have the following script:
The script is executed under linux, the target host is a windows machine. There are no errors, but the output is just#!/usr/bin/perl use strict; use warnings; use Net::SNMP; my ($session, $error) = Net::SNMP->session(Hostname => '172.25.0.5', Community => 'testcommunity', port => 161) or die "Session: $!\015\012"; my $ram = $session->get_request("1.3.6.1.2.1.25.2.2.0") + or die "get_request ram: $!\015\012"; my $uptime = $session->get_request("1.3.6.1.2.1.25.1.1.0") +or die "get_request uptime: $!\015\012"; my $drive1 = $session->get_request("1.3.6.1.2.1.25.2.3.1.6.1") + or die "get_request drive1: $!\015\012"; my $processes = $session->get_request("1.3.6.1.2.1.25.1.6.0") + or die "get_request processes: $!\015\12"; $session->close; print "RAM: ".$ram->{"1.3.6.1.2.1.25.2.2.0"}."\015\12"; print "Uptime: ".$uptime->{"1.3.6.1.2.1.25.1.1.0"}."\015\012"; print "Drive 1: ".$drive1->{"1.3.6.1.2.1.25.2.3.1.6.1"}."\015\012"; print "Processes: ".$processes->{"1.3.6.1.2.1.25.1.6.0"}."\015\012";
When I try the same script under windows (with target host "localhost") the values are returned correctly. Where is my mistake? Thanks in advance!RAM: Uptime: Drive 1: Processes:
|
---|
Replies are listed 'Best First'. | |
---|---|
Re: snmp script with perl
by blue_cowdawg (Monsignor) on Dec 06, 2012 at 15:54 UTC | |
Re: snmp script with perl
by greengaroo (Hermit) on Dec 06, 2012 at 15:38 UTC | |
by MacScissor (Acolyte) on Dec 06, 2012 at 15:46 UTC | |
by greengaroo (Hermit) on Dec 06, 2012 at 15:57 UTC | |
Re: snmp script with perl
by RichardK (Parson) on Dec 06, 2012 at 16:08 UTC | |
Re: snmp script with perl
by FloydATC (Deacon) on Dec 06, 2012 at 19:26 UTC |
Back to
Seekers of Perl Wisdom