Fixing check_snmp_cisco_ifstatus

I’ll flesh this out later, but if you are having problems with the check_snmp_cisco_ifstatus plugin for nagios, and you are getting errors like the one below, you need to make a couple of tweaks.

**ePN failed to compile /usr/lib64/nagios/plugins/check_snmp_cisco_ifstatus: Global symbol script requires explicit package name at (eval 7) line 30,

Right after the line that reads use Getopt::Std; you need to add the following three statements:

my ($oid_sysDescr,$community,$s,$e,$oid_temp,
$temp_interface_descr,$errorstring,$temp,$index,
$configfilepath,$hostname,$script,$script_version,
$critical,$ifadminstatus,$ifdescr,$ifinerrors,$iflastchange,
$ifmtu,$ifoperstatus,$ifoutbitssec,$ifouterrors,$ifoutqlen,
$ifphysaddress,$ifspeed,$iftype,$number_of_interfaces,
$oid_ifadminstatus,$oid_ifdescr,$oid_ifinerrors,
$oid_iflastchange,$oid_ifmtu,$oid_ifnumber,
$oid_ifoperstatus,$oid_ifouterrors,$oid_ifoutqlen,
$oid_ifphysaddress,$oid_ifspeed,$oid_iftype,
$oid_locIfIntBitsSec,$oid_locIfOutBitsSec,$oid_sysdescr,
$returnstring,$status,$target_interface,
$target_interface_index,$timeout,$version,$warning);

our ($opt_c,$opt_C,$opt_h,$opt_H,$opt_w,$opt_i);

$status=0;

The short story is that Nagios has moved to used re-compiled perl, and as a security feature they insert several strictness policies regarding variable handling. You can disable this via nagios.cfg in version 3.0, but config template for 2.0 doesn’t have this option and I haven’t had a chance to try the setting anyways just to see what happens.

Verbose documentation regarding how this affects your plugins can be found here:

Nagios 2.x
Nagios 3.x

[ad#adsense-horizontal]

I use Amazon affiliate links in some of my posts. I think it is fair to say my writing is not influenced by the $0.40 I earned in 2022.