Click here to get back home

please helpme: Net-SNMP-5.2.0 module

 HomeNewsGroups | Search | About
 comp.lang.perl.modules    Post an article   get this group's latest topics as an RSS feed add this group's latest topics to your My MSN content add this group's latest topics to your My Yahoo content
Subject Author Date
please helpme: Net-SNMP-5.2.0 module milaus 08-29-2006
Posted by milaus on August 29, 2006, 11:47 am
Please log in for more thread options


Hi all,
this is my first post to this ng, sorry if my question appears stupid or
misplaced.
I'm writing a perl script to monitor some JBOSS variables via SNMP, but
I've a problem passing a community string different from 'public'.
I'll try to explain, this is my environment:
- hostname: wi064111
- on port 11112 a snmp-agent listens with community 'public'
- on port 11212 a snmp-agent listens with community 'q3lrcdjb'

By using a snmp-get (from another host) everything works:

[root@cst003 ~]# snmpget -c public -v 1 wi064111:11112 1.2.3.4.1.2
iso.2.3.4.1.2 = Gauge32: 88502720
[root@cst003 ~]#
[root@cst003 ~]# snmpget -c q3lrcdjb -v 1 wi064111:11212 1.2.3.4.1.2
iso.2.3.4.1.2 = Gauge32: 92236344

By using this perl script, I got the problem:
##############################################
# Script-begin
#
#!/usr/bin/perl
use Net::SNMP;
# requires a hostname a community string and a port as its arguments
($session,$error) = Net::SNMP->session(Hostname => $ARGV[0],
Community => $ARGV[1],
Port => $ARGV[2]);
die "session error: $error" unless ($session);
printf("Port: %s Community: %s Hostname: %s\n", $ARGV[2], $ARGV[1],$ARGV[0]);
$result = $session->get_request("1.2.3.4.1.2");
die "request error:".$session->error unless (defined $result);
$session->close; print "Free Memory: ".$result->."\n";
#
# Script-end
###########################

This are the output with the two different community strings:

[root@wi064111 ~]# ./myscript.pl wi064111 public 11112
Port: 11112 Community: public Hostname: wi064111
Free Memory: 87953768

[root@wi064111 ~]# ./myscript.pl wi064111 q3lrcdjb 11212
Port: 11212 Community: q3lrcdjb Hostname: wi064111
request error: Bad incoming community [public] at ./aaa.pl line 18.

It sounds like $session->get_request method doesn't care about the
community string I've set.

Is it possbile that a perl module at version 5.2 contains such a bug or am
I doing some mistakes?

Thanks to everyone that just read the wole post :-)
Many thanks to everyone that can help me :-))

Ing. Marco Betti
RHCE RHEL4 id 804006512121056


Posted by Dr.Ruud on August 29, 2006, 1:18 pm
Please log in for more thread options


milaus schreef:

> Hi all,
> this is my first post to this ng, sorry if my question appears stupid
> or misplaced.

It's best to cancel one of the messages. Post only to the most fitting
group.
http://www.uwasa.fi/~ts/http/crospost.html

--
Affijn, Ruud

"Gewoon is een tijger."



Posted by milaus on August 29, 2006, 1:32 pm
Please log in for more thread options


Il Tue, 29 Aug 2006 19:18:20 +0200, Dr.Ruud ha scritto:

> milaus schreef:
>
>> Hi all,
>> this is my first post to this ng, sorry if my question appears stupid
>> or misplaced.
>
> It's best to cancel one of the messages. Post only to the most fitting
> group.

Yes, I know, but this is a urgent situation and maybe that someone who can
help me reads only one of two ng I sent the post and I'm very in trouble
with this problem :-( (my boss thinks that I've already finished this
job...)
So, please, don't be so severe :-)
Milaus

P.S. Anyway, should this-one be the right place?


Posted by Dr.Ruud on August 29, 2006, 9:17 pm
Please log in for more thread options


milaus schreef:


> [multi-posting]
> this is a urgent situation and maybe that someone
> who can help me reads only one of two ng

You could have cross-posted in stead of multi-posted. Have you read the
article?

Multi-posting is simply not acceptable; cross-posting is sometimes good
but most often it is not.

--
Affijn, Ruud

"Gewoon is een tijger."



Posted by John Bokma on August 30, 2006, 12:21 am
Please log in for more thread options



> Yes, I know, but this is a urgent situation

then hire someone who can give you professional support. Remember that
Usenet is a huge group of volunteers. You're not paying them. Stating that
something is urgent often has the opposite effect.

Finally, if you're telling your boss something is finished while it isn't
that's *YOUR* problem.


--
John Experienced Perl programmer: http://castleamber.com/

Perl help, tutorials, and examples: http://johnbokma.com/perl/

Similar ThreadsPosted
Lower case module name for non-pragma module January 4, 2005, 10:19 am
RFC: New module 'Module::Bundled::Files' August 26, 2005, 3:49 pm
help with an MD5.pm module!! September 3, 2005, 11:39 pm
Looking for RTP module December 9, 2004, 9:17 pm
module for FFT May 9, 2005, 3:06 pm
Module may not be right one? April 27, 2006, 12:57 pm
The 'if' module June 1, 2006, 8:18 pm
The 'if' module June 1, 2006, 8:26 pm
use module March 3, 2007, 5:13 am
Name my Module! July 27, 2007, 6:46 pm

Our other projects:

Art Dolls, Fairies and Mermaids - Sunnyfaces.net

Roy's Linux, Programming and Search Engines messages

1-Script XML SitemapXML Sitemap