please helpme: Net-SNMP-5.2.0 module

please helpme: Net-SNMP-5.2.0 module

am 29.08.2006 17:47:51 von milaus

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->{"1.2.3.4.1.2"}."\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

Re: [multi-posted] please helpme: Net-SNMP-5.2.0 module

am 29.08.2006 19:18:20 von rvtol+news

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."

Re: [multi-posted] please helpme: Net-SNMP-5.2.0 module

am 29.08.2006 19:32:07 von milaus

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?

Re: [multi-posted] please helpme: Net-SNMP-5.2.0 module

am 30.08.2006 03:17:47 von rvtol+news

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."

Re: [multi-posted] please helpme: Net-SNMP-5.2.0 module

am 30.08.2006 06:21:34 von John Bokma

milaus wrote:

> 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/