Troubleshooting some nagios error

Posted by Md. Mahidul Hasan on 10:17 PM with No comments
Troubleshooting Experience:
Troubleshooting some Nagios error:

Recently I was trying to deploy nagios to a RedHat 6 Server which I am use to deploy it in debian box. And as usual I found many problems in the installation procedure. One of the unusal thing is that I use latest nagios 3.5 and it does not have statusmap.cgi file and have some dependency issue. It gave me a hard time to solve the issue :D. So, This is how I fixed those problems-

1. snmp plugin fails due to perl dependency:
Error: Can't locate Net/SNMP.pm in @INC (@INC contains: /usr/local/lib64/perl5 /usr/local/share/perl5 /usr/lib64/perl5/vendor_perl /usr/share/perl5/vendor_perl /usr/lib64/perl5 /usr/share/perl5 .) at ./check_snmp_storage.pl line 15. BEGIN failed--compilation aborted at ./check_snmp_storage.pl line 15.

Solution:

To solve the problem we need to install perl-Net-SNMP which we can implement by following two ways:

Install from rpm:
[root@centoshost01 ~]# wget http://dl.fedoraproject.org/pub/epel/6/x86_64/perl-Net-SNMP-5.2.0-4.el6.noarch.rpm
[root@centoshost01 ~]# wget http://dl.fedoraproject.org/pub/epel/6/x86_64/perl-Crypt-DES-2.05-9.el6.x86_64.rpm
[root@centoshost01 ~]# rpm -ivh perl-Net-SNMP-5.2.0-4.el6.noarch.rpm
[root@centoshost01 ~]# rpm -ivh perl-Crypt-DES-2.05-9.el6.x86_64.rpm

Or
Install from yum:
[root@centoshost01 ~]# vim /etc/yum.repos.d/perl.repo
[Perl]
name=Perl Client
baseurl=http://dl.fedoraproject.org/pub/epel/6/x86_64/
enabled=1
gpgcheck=0

[root@centoshost01 ~]# yum list
[root@centoshost01 ~]# yum install perl-Net-SNMP

2. Error: "Nagios HTTP WARNING: HTTP/1.1 403 Forbidden" shows from the nagios web panel.


Solution:
[root@app1 ~]# vim /var/www/html/index.html
This is local app1 server.
[root@app1 ~]# service httpd restart

3. Error: Not Found - The requested URL /nagios/cgi-bin/statusmap.cgi was not found on this server.

Solution:
This problem happens with the new nagios version 3.5. First check the /usr/local/nagios/sbin folder if it contains the statusmap.cgi file. If not copy the file from the untar nagios folder to /usr/local/nagios/sbin. If nagios 3.5 does not have the statusmap.cgi then download the nagios 3.4.1 and copy the statusmap.cgi to your /usr/local/nagios/sbin location. If still not showing the map from nagios then follow the below steps-

[root@centoshost01 ~]# yum install gd gd-devel

or install it from rpm,
# Download and install gd which is a graphics library for quick creation of PNG or JPEG images
[root@centoshost01 ~]# yum remove gd
[root@centoshost01 ~]# wget http://rpm.pbone.net/index.php3/stat/4/idpl/15161687/dir/redhat_el_6/com/libgd2-2.0.33-2_11.el6.x86_64.rpm.html && wget ftp://ftp.pbone.net/mirror/atrpms.net/sl6-x86_64/atrpms/testing/gd-devel-2.0.33-2_11.el6.x86_64.rpm && wget http://dl.atrpms.net/el6-x86_64/atrpms/testing/gd-2.0.33-2_11.el6.x86_64.rpm
[root@centoshost01 ~]# rpm -ivh libgd2-2.0.33-2_11.el6.x86_64.rpm
[root@centoshost01 ~]# rpm -ivh gd-2.0.33-2_11.el6.x86_64.rpm
[root@centoshost01 ~]# rpm -ivh gd-devel-2.0.33-2_11.el6.x86_64.rpm

[root@centoshost01 ~]# cd /nagios-3.4.1/
[root@centoshost01 ~]# ./configure -with-gd-lib=/usr/local/lib/
[root@centoshost01 ~]# make cgis
[root@centoshost01 ~]# cp /nagios-3.4.1/cgi/*.cgi /usr/local/nagios/sbin
[root@centoshost01 ~]# chown nagios:nagios /usr/local/nagios/sbin/*.cgi