SNMP Perl Plugin use custom MIB

This forum is intended for the discussion of Nagios plugin development. Feature requests, patches, bug fixes, and all types of development-related discussions are welcome!

NOTE: The SourceForge.net nagiosplug-devel mailing list has been deprecated in favor of this forum in order to expedite support and provide additional features not available on the old mailing list.

SNMP Perl Plugin use custom MIB

Postby DeathDream » Wed Oct 25, 2017 1:51 pm

I'm building a custom perl plugin for SNMP that heavily depends on the MIB that I uploaded. How do I build the plugin to use this specific MIB?

Code: Select all
my ($session, $error) = Net::SNMP->session(
-hostname       => $Hostname,
-community       => $Community,
#-miblist       => 'F5-BIGIP-LOCAL-MIB',
#Above did not work
-port          => 161,
-version       => 'snmpv2c',
-nonblocking    => 0
);


If that cannot be done, how can I convert ASCII ($PoolName) entered variable to decimal value to make that an OID within perl? (Kinda outside a nagios related question but figured I'd ask here as well)

If I can use the MIB this would be how I pool
Code: Select all
my($PoolName)    =    $ARGV[1];
my($OIDPoolStatus)       =    "ltmPoolStatusAvailState.\\\"$PoolName\\\"";
my $polled_oids_1 = $session->get_request(-varbindlist => [$$OIDPoolStatus]);
DeathDream
 
Posts: 2
Joined: Thu Oct 12, 2017 3:18 pm

Re: SNMP Perl Plugin use custom MIB

Postby tmcdonald » Wed Oct 25, 2017 1:56 pm

Definitely something that would be best asked in a forum dedicated to Perl, as it does not seem to pertain to anything Nagios-specific.

Regarding the string -> int conversion, I don't think you need to do that since what you are building is itself a string. And I also seem to recall Perl handling string -> int conversion nicely anyway:

https://stackoverflow.com/questions/288 ... er-in-perl
Be sure to check out our Knowledgebase for helpful articles and solutions!
User avatar
tmcdonald
Support Lead / Operations Engineer
 
Posts: 8720
Joined: Mon Sep 23, 2013 8:40 am

Re: SNMP Perl Plugin use custom MIB

Postby DeathDream » Wed Oct 25, 2017 2:24 pm

The main question in this post was about how can I get the plugin to be forced to use a MIB. I couldn't find anything in Net::SNMP about doing this.

I'm actually on stackoverflow now looking at the conversion process as well lol however what I found was exactly the opposite of what I was wanting: https://stackoverflow.com/questions/714 ... conversion
I'll give your link a shot if the MIB isn't an option.
DeathDream
 
Posts: 2
Joined: Thu Oct 12, 2017 3:18 pm

Re: SNMP Perl Plugin use custom MIB

Postby kyang » Wed Oct 25, 2017 3:33 pm

Sounds good, let us know if you have any more questions

Or if you are okay to close this thread.
Be sure to check out our Knowledgebase for helpful articles and solutions!
User avatar
kyang
 
Posts: 660
Joined: Tue Jul 25, 2017 3:35 pm


Return to Nagios Plugin Development

Who is online

Users browsing this forum: No registered users and 2 guests