Tuesday, 7 April 2015

Nagios Client configuration

Nagios Client configuration:-

Windows
------------
http://nsclient.org/nscp/downloads
install NSCP agent and give nagios Server IP

In nagios server,

vi /usr/local/nagios/etc/objects/myclientserver.cfg
vi /usr/local/nagios/etc/nagios.cfg

Add entry for myclientserver.cfg
/usr/local/nagios/bin/nagios -v /usr/local/nagios/etc/nagios.cfg
/etc/init.d/nagios restart

Linux
------------
Download the required packages example,
nrpe-2.14.tar.gz
nagios-plugins-2.0.tar.gz

tar -xzvf nagios-plugins-2.0.tar.gz
tar -xzvf nrpe-2.14.tar.gz

yum install gcc
yum install openssl*
ldconfig

cd nagios-plugins-2.0
 ./configure
 make
 make install
 useradd nagios
 chown -R nagios:nagios /usr/local/nagios

cd ../nrpe-2.14
 ./configure
 make all
 make install-plugin
 make install-daemon
 yum install xinetd
 make install-daemon-config
 make install-xinetd

vi /etc/xinetd.d/nrpe
only_from       = 127.0.0.1 10.11.22.22

vi /etc/services
nrpe            5666/tcp                # nrpe

/etc/init.d/xinetd restart
 netstat -an | grep -i 5666

 yum install telnet
 telnet 10.11.22.22 5666

 ifconfig
 yum install sysstat

 cd /usr/local/nagios/
 mv /home/agoviku/libexec.tar.gz .
 mv /home/agoviku/md5s .
 chown -R nagios.nagios /usr/local/nagios
 tar -xzvf libexec.tar.gz

scp -r /usr/local/nagios/libexec usename@10.11.11.59:/tmp

cp -r /tmp/libexec /usr/local/nagios/
chown -R nagios:nagios /usr/local/nagios/
chmod -R 755 /usr/local/nagios/libexec

For Web servers,
vi /usr/local/nagios/etc/nrpe.cfg
command[check_users]=/usr/local/nagios/libexec/check_users -w 5 -c 10
command[check_load]=/usr/local/nagios/libexec/check_load -w 15,10,5 -c 30,25,20
command[check_disk1]=/usr/local/nagios/libexec/check_disk -w 20% -c 10% -p /
command[check_disk2]=/usr/local/nagios/libexec/check_disk -w 20% -c 10% -p /data
command[check_zombie_procs]=/usr/local/nagios/libexec/check_procs -w 5 -c 10 -s Z
command[check_total_procs]=/usr/local/nagios/libexec/check_procs -w 400 -c 450
command[check_sendmail]=/usr/local/nagios/libexec/check_tcp -H localhost -p 25
command[check_cpu]=/usr/local/nagios/libexec/check_cpu.sh -w 60 -c 90
command[check_rofs1]=/usr/local/nagios/libexec/check_rofs.sh /
command[check_rofs2]=/usr/local/nagios/libexec/check_rofs.sh /data
command[check_md5]=/usr/local/nagios/libexec/check_md5.sh /etc/httpd/conf.d/vhost.conf
command[check_crond]=/usr/local/nagios/libexec/check_procs -c 1:20 -C crond
command[check_apache]=/usr/local/nagios/libexec/check_apache.sh -w 100 -c 200
command[check_apache2]=/usr/local/nagios/libexec/check_apache2.sh -w 100 -c 200

For DB servers,
vi /usr/local/nagios/etc/nrpe.cfg
command[check_users]=/usr/local/nagios/libexec/check_users -w 5 -c 10
command[check_load]=/usr/local/nagios/libexec/check_load -w 15,10,5 -c 30,25,20
command[check_disk]=/usr/local/nagios/libexec/check_disk -w 20% -c 10% -p /data
command[check_zombie_procs]=/usr/local/nagios/libexec/check_procs -w 5 -c 10 -s Z
command[check_total_procs]=/usr/local/nagios/libexec/check_procs -w 250 -c 300
command[check_cpu]=/usr/local/nagios/libexec/check_cpu.sh -w 60 -c 90
command[check_md5]=/usr/local/nagios/libexec/check_md5.sh /etc/my.cnf
command[check_mysql]=/usr/local/nagios/libexec/check_mysql -u nagiosusr -p 'passwrod' -s /data/var/lib/mysql/mysql.sock
command[check_mysql2]=/usr/local/nagios/libexec/check_mysql_health --hostname localhost --username nagiosusr --password 'passwrod' --mode threads-connected   mysql2
command[check_mysql3]=/usr/local/nagios/libexec/check_mysql_health --hostname localhost --username nagiosusr --password 'passwrod' --mode  threadcache-hitrate  mysql3
command[check_mysql4]=/usr/local/nagios/libexec/check_mysql_health --hostname localhost --username nagiosusr --password 'passwrod' --mode threads-created  mysql4
command[check_mysql5]=/usr/local/nagios/libexec/check_mysql_health --hostname localhost --username nagiosusr --password 'passwrod' --mode threads-running mysql5
command[check_mysql6]=/usr/local/nagios/libexec/check_mysql_health --hostname localhost --username nagiosusr --password 'passwrod' --mode threads-cached  mysql6
command[check_mysql7]=/usr/local/nagios/libexec/check_mysql_health --hostname localhost --username nagiosusr --password 'passwrod' --mode connects-aborted  mysql7
command[check_mysql8]=/usr/local/nagios/libexec/check_mysql_health --hostname localhost --username nagiosusr --password 'passwrod' --mode clients-aborted  mysql8
command[check_mysql9]=/usr/local/nagios/libexec/check_mysql_health --hostname localhost --username nagiosusr --password 'passwrod' --mode  qcache-hitrate --lookback 1800 --warning 50 --critical 20  mysql9
command[check_mysql10]=/usr/local/nagios/libexec/check_mysql_health --hostname localhost --username nagiosusr --password 'passwrod' --mode  qcache-lowmem-prunes mysql10
command[check_mysql11]=/usr/local/nagios/libexec/check_mysql_health --hostname localhost --username nagiosusr --password 'passwrod' --mode  keycache-hitrate --warning 50: --critical 20:  mysql11
command[check_mysql12]=/usr/local/nagios/libexec/check_mysql_health --hostname localhost --username nagiosusr --password 'passwrod' --mode  bufferpool-hitrate  mysql12
command[check_mysql13]=/usr/local/nagios/libexec/check_mysql_health --hostname localhost --username nagiosusr --password 'passwrod' --mode   bufferpool-wait-free mysql13
command[check_mysql14]=/usr/local/nagios/libexec/check_mysql_health --hostname localhost --username nagiosusr --password 'passwrod' --mode   log-waits  mysql14
command[check_mysql15]=/usr/local/nagios/libexec/check_mysql_health --hostname localhost --username nagiosusr --password 'passwrod' --mode   tablecache-hitrate mysql15
command[check_mysql16]=/usr/local/nagios/libexec/check_mysql_health --hostname localhost --username nagiosusr --password 'passwrod' --mode   table-lock-contention mysql16
command[check_mysql17]=/usr/local/nagios/libexec/check_mysql_health --hostname localhost --username nagiosusr --password 'passwrod' --mode  index-usage --warning 30: --critical 10: mysql17
command[check_mysql18]=/usr/local/nagios/libexec/check_mysql_health --hostname localhost --username nagiosusr --password 'passwrod' --mode  tmp-disk-tables mysql18
command[check_mysql19]=/usr/local/nagios/libexec/check_mysql_health --hostname localhost --username nagiosusr --password 'passwrod' --mode   open-files  mysql19
command[check_mysql20]=/usr/local/nagios/libexec/check_mysql_health --hostname localhost --username nagiosusr --password 'passwrod' --mode   slow-queries  mysql20
command[check_mysql21]=/usr/local/nagios/libexec/check_mysql_health --hostname localhost --username nagiosusr --password 'passwrod' --mode   long-running-procs mysql21

In nagios server,
vi /usr/local/nagios/etc/nagios.cfg
 /usr/local/nagios/bin/nagios -v /usr/local/nagios/etc/nagios.cfg
/etc/init.d/nagios restart

install check_mysql_health in /usr/local/nagios/libexec

yum -y install cpan DBI*
cpan
install Time::HiRes
exit
yum -y install DBI*
cpan
install DBD::mysql
exit
ln -s /data/var/lib/mysql/mysql.sock /var/lib/mysql/mysql.sock

Ref :- https://labs.consol.de/nagios/check_mysql_health/


Few Known errors :-
-------------------------------------------------------------
/usr/local/nagios/libexec/check_nrpe -H 10.111.111.33 -p 5666
CHECK_NRPE: Error - Could not complete SSL handshake.

vi /etc/xinetd.d/nrpe
only_from       = 127.0.0.1 10.11.22.22

service xinetd restart

/usr/local/nagios/libexec/check_nrpe -H 10.33.66.10 -p 5666
NRPE v2.14

Ref: http://assets.nagios.com/downloads/nagiosxi/docs/NRPE-Troubleshooting-and-Common-Solutions.pdf
-------------------------------------------------------------
File Integrity
CRITICAL - file does not exist!(Nagios)

ll /etc/httpd/conf.d/vhost.conf
ls: cannot access /etc/httpd/conf.d/vhost.conf: No such file or directory
touch /etc/httpd/conf.d/vhost.conf

/usr/local/nagios/libexec/check_md5.sh /etc/httpd/conf.d/vhost.conf
OK
-------------------------------------------------------------
mysql Access denied for user 'monitor'@'localhost' (using password: YES)

grant all  on *.* to 'nagiosusr'@'%' identified by 'passwrod';
FLUSH PRIVILEGES;
-------------------------------------------------------------------------

No comments:

Post a comment