Nagios fail to run ifstatus

/usr/local/nagios/libexec/check_ifstatus -H localhost

&nbsp

Can’t locate Net/SNMP.pm in @INC (@INC contains: /usr/local/nagios/libexec /usr/local/lib/perl5 /usr/local/share/perl5 /usr/lib/perl5/vendor_perl /usr/share/perl5/vendor_perl /usr/lib/perl5 /usr/share/perl5 .) at ./check_ifstatus line 38.

BEGIN failed–compilation aborted at ./check_ifstatus line 38.

 

Solution:

yum install perl-Net-SNMP

Nagios configuration debugging

After testing a nagios configuration update ( including a new service or renaming some host etc..) before committing the changes and reloading / restarting the nagios service a good test is the following:

/usr/local/nagios/bin/nagios -v /usr/local/nagios/etc/nagios.cfg
(more…)

Quick script to get path to latest nagios version

If you need to automate the retrieval of the latest Nagios version path to download this is how I do it.

Nothing fancy and it breaks if they change the sourceforge site but we can fix when that happens 🙂

 

curl -v http://www.nagios.org/download/core/thanks/ 2>&1 | grep tar\.gz | cut -d \” -f 2 | sort -r | head -n 1

Result:

http://prdownloads.sourceforge.net/sourceforge/nagios/nagios-3.4.1.tar.gz

Of course this comes in handy when pulling for the clients being monitored so by extension:

 curl -v http://www.nagios.org/download/plugins/ 2>&1 | grep tar\.gz | cut -d \” -f 2 | sort -r | head -n 1

Result:

http://prdownloads.sourceforge.net/sourceforge/nagiosplug/nagios-plugins-1.4.16.tar.gz

Getting the files in a script is as easy as :

curl -v http://www.nagios.org/download/plugins/ 2>&1 | grep tar\.gz | cut -d \” -f 2 | sort -r | head -n 1 | xargs wget

Ping me if this stops working for you.

Enjoy.