vortmax has asked for the wisdom of the Perl Monks concerning the following question:
running this gives:#!/usr/bin/perl use warnings; use strict; use SNMP; use Socket; my $host = 'xxx.xxx.xxx.xxx'; my $oid = '1.3.6.1.2.1.1.4'; my $sver = '1'; my $comm = 'secret'; my $session; my $reply; &SNMP::initMib(); my %snmpparms; $snmpparms{Community} = $comm; $snmpparms{DestHost} = inet_ntoa(inet_aton($host)); $snmpparms{Version} = $sver; $snmpparms{UseSprintValue} = '1'; $snmpparms{RemotePort} = '163'; $session = new SNMP::Session(%snmpparms); $reply = $session->get($oid); if ($session->{ErrorNum}) { die "DOOM!: ".$session->{ErrorStr}."\n"; } print "$reply\n";
I know the server is reachable over port 163, as I'm running other monitoring software and I've been able to get this to work in php. So I guess my question is two-fold. How do I get snmp to work over port 163 and is there a better way to approach this? Possibly make a socket connection with the server over port 80, send some headers and check the reply?DOOM!: Timeout
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re: SNMP RemotePort
by superfrink (Curate) on Apr 10, 2008 at 19:23 UTC | |
by vortmax (Acolyte) on Apr 10, 2008 at 20:12 UTC |