42bios
August 20, 2019, 9:20am
1
Hi Icinga Community,
I’m new here and tried to modify an existing check to monitor HPE switches.
Hopefully someone can help me solve the problem or give me hints.
Problem:
SNMP OID works with Paessler SNMP Tester
in icinga the check indicates that there is no OID.
to my project
Thank you in advance!
dnsmichi
(Michael Friedrich)
August 20, 2019, 10:24am
2
Hi,
try it the manual way - run snmpwalk/snmpget on the CLI and check whether the OIDs are available. It may be a permission or protocol problem too.
snmpwalk -v2c -c public localhost .1.3.6.1.2.1.47.1.1.1.1.2.1
Cheers,
Michael
1 Like
42bios
August 20, 2019, 11:23am
3
Hi Michael,
thanks!
snmpwalk -v2c -c public IP-address .1.3.6.1.2.1.47.1.1.1.1.2.1
I just tested it and with this command it works. But I don’t understand why the check isnt working?
greets Manuel
dnsmichi
(Michael Friedrich)
August 20, 2019, 11:41am
4
Hi,
the plugin’s code is hard to read, I would start investigating in this line …
if (!defined($s->get_request($oid_systype))) {
And add more verbose logging, e.g.
use Data::Dumper;
print Dumper($s);
for connection tests, likewise read the docs for get_request().
Also, you didn’t show how you call the plugin on the CLi, please add that.
Cheers,
Michael
1 Like
42bios
August 20, 2019, 12:35pm
5
“if it was hard to write, then it should also be hard to read”
Jokes aside, it’s my first code… still have to learn a lot
To test, I call the plugin with this CLi command:
root@icinga:/usr/local/nagios/libexec# ./check_hpe_procurve.pl -H IP-address -C public
output:
WARNING - SNMP OID CPU LOAD does not exist|
planned output:
OK - HP JXXX Switch - CPU LOAD: x % - MEMORY: x bytes FREE - FAN STATUS: x - PSU1 STATUS: x - PSU2 STATUS: x - TEMP STATUS: x - SYS TEMP: x °C -
Thanks, I will take a closer look at the docs.
greets Manuel
dnsmichi
(Michael Friedrich)
August 20, 2019, 1:57pm
6
Hi,
I’m used to several Perl styles, and have adopted one for the manubulon plugins with perltidy, you might want to have a look at this . Your style isn’t bad at all, just needs some more formatting love
One thing which differs to the snmpwalk plugin is the protocol. The argument parser allows to specify the version, but sets this to 2
if not given. Try the exact plugin call as you would do from the snmpwalk.
https://github.com/42bios/check_hpe_procurve.pl/blob/master/check_hpe_procurve.pl#L492
Also, don’t test as root but as the icinga user.
sudo -u icinga /usr/local/nagios/libexec/check_hpe_procurve.pl -H IP-address -C public --version 2c
Cheers,
Michael
42bios
August 26, 2019, 6:08am
7
Hi Michael,
many thanks for the input!