Professional Web Applications Themes

please helpme: Net-SNMP-5.2.0 module - PERL Modules

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: [rootcst003 ~]# snmpget -c public -v 1 wi064111:11112 1.2.3.4.1.2 iso.2.3.4.1.2 = Gauge32: 88502720 [rootcst003 ~]# [rootcst003 ~]# snmpget -c ...

  1. #1

    Default please helpme: Net-SNMP-5.2.0 module

    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:

    [rootcst003 ~]# snmpget -c public -v 1 wi064111:11112 1.2.3.4.1.2
    iso.2.3.4.1.2 = Gauge32: 88502720
    [rootcst003 ~]#
    [rootcst003 ~]# 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:

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

    [rootwi064111 ~]# ./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

    milaus Guest

  2. #2

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

    milaus schreef:
     

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


    Dr.Ruud Guest

  3. #3

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

    Il Tue, 29 Aug 2006 19:18:20 +0200, Dr.Ruud ha scritto:
     
    >
    > It's best to cancel one of the messages. Post only to the most fitting
    > group.[/ref]

    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?

    milaus Guest

  4. #4

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

    milaus schreef:

     

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


    Dr.Ruud Guest

  5. #5

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

    milaus <it> wrote:
     

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

Similar Threads

  1. Net::SNMP module
    By Amaninder.Saini@gmail.com in forum PERL Modules
    Replies: 1
    Last Post: June 4th, 03:23 AM
  2. If you've got a bit of time can you read this and helpme out
    By Scifo in forum Macromedia Director 3D
    Replies: 0
    Last Post: April 29th, 01:47 AM
  3. SNMP.pm
    By Wim in forum PERL Beginners
    Replies: 1
    Last Post: January 30th, 02:58 PM
  4. #25604 [NEW]: configure fails to define variables for use with snmp module
    By gaz at fission dot org dot uk in forum PHP Development
    Replies: 0
    Last Post: September 19th, 01:58 PM
  5. UCD-SNMP / NET-SNMP config for hostmib AIX 4.3.3
    By NickS in forum Linux / Unix Administration
    Replies: 4
    Last Post: September 11th, 11:24 AM

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139