Works fine for me.... a couple of points, however:
- You might want to use the default SNMP port (161), rather than 178
- Your error sortof suggests to me that something might be going wrong with either Socket6 or IO::Socket::INET6. Are you sure you installed those correctly?
Cheers,
Darren :) | [reply] [Watch: Dir/Any] |
McDarren is right, the snmp port (by default, and if and only if you didn't change where the server is listening) is the 161.
Anyway, I think you don't need to install IO::Socket::INET6 support to get your script running. You only need to know if your snmp server (or better, your target agent) is listening at port 161 over udp or tcp.
You can change the default behaviour (by default server and clients use udp) of your perl script snmp client, by specifying the 'domain' option (see Net::SNMP)
good luck!
perl -Te 'print map { chr((ord)-((10,20,2,7)[$i++])) } split //,"turo"'
| [reply] [Watch: Dir/Any] [d/l] |
Whee! This is fun!
Please reference the original question by someone named Geetha. Sure, madtoperl could be "Geetha", but why would madtoperl change the name of the script, and the IP address (but only slightly) when posting in a different forum?
Net::SNMP session creating problem
Posted by geetha... on 9/7/2004 11:34:00 AM
Hi ,
I'm using NET::SNMP perl package to send do SNMP operations.
This requires establishing snmp session.
upon calling create session , I'm getting error "ERROR: Unknown error
+creating socket."
The code which gives the above error is given below.
***************************************************************
# /usr//bin/perl
# snmp.pl to test snmp functions
use strict;
use vars qw($session $error $response);
use Net::SNMP;
($session, $error) = Net::SNMP->session(
-hostname => shift || 'localhost',
-community => shift || 'public',
-port => shift || 161
);
if (!defined($session)) {
printf("ERROR: %s.\n", $error);
exit 1;
}
*************************************END *****************************
+*************
I execute the program as :
perl snmp.pl 192.168.20.158 public
output of the program:
ERROR: Unknown error creating socket.
**********************************************************************
+**************
As part of debugging this, I read that NET::SNMP package requires Soc
+ket6 & IO::Socket::INET6 packages . I installed them, but problem is
+still persisting
As regarding system configuration , it is a linux OS ,localhost is ena
+bled through httpd server.
On the command prompt "snmpwalk -v2c -c public localhost system" gives
+ the output of snmpwalk
Can someone help with this session creating problem. I 'm debugging t
+his problem from past 3 days, but ...
Thanks,
Geetha
--chargrill
s**lil*; $*=join'',sort split q**; s;.*;grr; &&s+(.(.)).+$2$1+; $; =
qq-$_-;s,.*,ahc,;$,.=chop for split q,,,reverse;print for($,,$;,$*,$/)
| [reply] [Watch: Dir/Any] [d/l] [select] |