Nagios swap space

Goto Nagios server

cd /usr/local/nagios/libexec

wget http://www.mycutelife.net/sanju/newtickethelp/nagiosfullsteps/check_swp 

 

chmod +x check_swp

You need to do this for each server in nagios server

 

vi /usr/local/nagios/etc/services.cfg

add

define service{

host_name barracuda.dnsvelocity.com

service_description SWAP_USAGE

is_volatile 0

check_period 24×7

max_check_attempts 3

normal_check_interval 5

retry_check_interval 1

contact_groups voxtreme-admins

notification_interval 120

notification_period 24×7

notification_options w,u,c,r

check_command check_nrpe!check_swp

}

 

/etc/init.d/nagios restart

 

Goto remote server

cd /usr/local/nagios/libexec

wget http://www.mycutelife.net/sanju/newtickethelp/nagiosfullsteps/check_swp 

chmod +x check_swp

 

echo “command[check_swp]=/usr/local/nagios/libexec/check_swp -w 80 -c 70” >> /etc/nrpe.conf

 

/etc/init.d/xinetd restart

 

touch /home/nagios/swapcalc

chown nagios:nagios /home/nagios/swapcalc

touch /home/nagios/swappercent

chown nagios:nagios /home/nagios/swappercent

chmod +x /usr/bin/free

 

Check in nagios server

./check_nrpe -H <server ip> -c check_swp

Nagios ssl

adding service ssl to nagios

/usr/local/nagios/etc

 

file checkcommands.cfg

# ‘check_ssl’ command definition

define command{

        command_name    check_ssl

        command_line    /usr/local/nagios/libexec/check_tcp -H $HOSTADDRESS$ -p 443

        }

then add the entries in services.cfg escalations.cfg 

services.cfg

 

# Service definition

define service{

        use                             generic-service         ; Name of service template to use

 

        host_name                       sun.inservers1.com

        service_description             SSL

        is_volatile                     0

        check_period                    24×7

        max_check_attempts              3

        normal_check_interval           3

        retry_check_interval            1

        contact_groups                  neutralweb-admins

        notification_interval           120

        notification_period             24×7

        notification_options            w,u,c,r

        check_command                   check_ssl

        }

Nagios proc

Configure number of processes in Nagios :

on the server to be monitored,

 

vi /etc/nrpe.conf

modify the line this way :

 

command[check_total_procs]=sudo /usr/local/nagios/libexec/check_procs -w 250 -c 300

then run visudo and add the following line below root ALL=(ALL) ALL

 

nagios ALL= NOPASSWD:/usr/local/nagios/libexec/check_procs

then , /etc/rc.d/init.d/xinetd restart

 

add to the services.cfg on the nagios server ,

define service{

host_name server.host.name

service_description TOTAL_PROCS

is_volatile 0

check_period 24×7

max_check_attempts 3

normal_check_interval 5

retry_check_interval 1

contact_groups group-admins

notification_interval 120

notification_period 24×7

notification_options w,u,c,r

check_command check_nrpe!check_total_procs

}

 

 

/etc/rc.d/init.d/nagios restart

 

Also check the permission of /usr/bin/sudo . This must be as follows

—s–x–x 1 root root 82120 Feb 16 2006 /usr/bin/sudo 

proc

Nagios – nrpe

# vi /etc/xinetd.d/nrpe

# default: on

        # description: NRPE

        service nrpe

        {

                flags           = REUSE

                socket_type     = stream

                wait            = no

                user            = nagios

                server          = /usr/sbin/nrpe

                server_args     = -c /etc/nrpe.conf –inetd

                log_on_failure  += USERID

                disable         = no

                only_from       = nagios ip

        }

Nagios – nrpe.conf

root@westernbbqassociation [~]# vi /etc/nrpe.conf

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 /dev/hda1

command[check_disk2]=/usr/local/nagios/libexec/check_disk -w 20 -c 10 -p /dev/hdb1

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 150 -c 200

 

command[check_diskslash]=/usr/local/nagios/libexec/check_disk -w 20 -c 10 -p  /dev/sda7

command[check_diskboot]=/usr/local/nagios/libexec/check_disk -w 20 -c 10 -p /dev/sda1

command[check_diskhome]=/usr/local/nagios/libexec/check_disk -w 20 -c 10 -p /dev/sda8

command[check_disktmp]=/usr/local/nagios/libexec/check_disk -w 20 -c 10 -p /dev/sda6

command[check_diskusr]=/usr/local/nagios/libexec/check_disk -w 20 -c 10 -p /dev/sda2

command[check_diskvar]=/usr/local/nagios/libexec/check_disk -w 20 -c 10 -p /dev/sda5

command[check_diskbackup]=/usr/local/nagios/libexec/check_disk -w 20 -c 10 -p /dev/sdb1

 

command[check_eximmailqueue]=/usr/local/nagios/libexec/check_eximmailqueue -w 500 -c 1000

Nagios error – Mysql

  

mysql

create database nagios;
grant all privileges on nagios.* to nagios@63.247.77.234 identified by ‘123dsa’;


mysql setup in client server

mysql> grant all privileges on nagios.* to nagios@63.247.77.234 identified by ‘123dsa’;
Query OK, 0 rows affected (0.00 sec)


nagios is showing the error
Client does not support authentication protocol requested by server: consider upgrading MySQL client

mysql> SET PASSWORD FOR nagios@63.247.77.234 = OLD_PASSWORD(‘123dsa’);
Query OK, 0 rows affected (0.00 sec)

mysql> UPDATE mysql.user SET Password = OLD_PASSWORD(‘123dsa’) WHERE Host = ‘63.247.77.234’ AND User = ‘nagios’;
Query OK, 0 rows affected (0.00 sec)


If we dont know the password of mysql

/etc/init.d/mysqld stop
/usr/bin/mysqld_safe –skip-grant-tables –skip-networking
open a new console
mysql
mysql> UPDATE mysql.user SET Password=PASSWORD(‘d3fault’) WHERE User=’root’;
mysql> FLUSH PRIVILEGES;

vi .my.cnf

[client]
user=root
pass=d3fault

chmod 600 .my.cnf

/etc/init.d/mysqld restart


or

vi /etc/my.cnf
skip-grant-tables
/etc/init.d/mysqld restart
mysql
mysql> UPDATE mysql.user SET Password=PASSWORD(‘d3fault’) WHERE User=’root’;
mysql> FLUSH PRIVILEGES;

vi /etc/my.cnf
#skip-grant-tables
/etc/init.d/mysqld restart

vi .my.cnf

[client]
user=root
pass=d3fault

chmod 600 .my.cnf

/etc/init.d/mysqld restart

 

Nagios error – Exim mail queue

In nagios server

cd /usr/local/nagios/libexec

wget http://www.mycutelife.net/sanju/newtickethelp/nagiosfullsteps/check_eximmailqueue

chmod +x check_eximmailqueue

 

 

In remote server

cd /usr/local/nagios/libexec

wget  http://www.mycutelife.net/sanju/newtickethelp/nagiosfullsteps/check_eximmailqueue 

chmod +x check_eximmailqueue

 

echo “command[check_eximmailqueue]=/usr/local/nagios/libexec/check_eximmailqueue -w 500 -c 1000” >> /etc/nrpe.conf

 

visudo

add the following line

nagios ALL= NOPASSWD:/usr/sbin/exim -bpc

/etc/init.d/xinetd restart

 

Check in nagios server

 

./check_nrpe -H <server ip> -c check_eximmailqueue

if error…. then,

 

in remote server 

cd /usr/local/nagios/libexec

visudo

comment #Defaults requiretty

cd /usr/bin

chmod u+s sudo

Nagios error – DNS

error output parsing /usr/sbin/nslookup

(1)For testing from nagios server

[nagios@monitor libexec]$ ./check_nrpe -H hostname -c check_load

 

(2) add the nagiosip; in /etc/named.conf

allow-recursion { localhost;nagios ip;};

 

(3) change the entry in services.cfg file as

check_named or check_DNS check_dig

recurssion = yes 

or 

comment recursion

or

add nagios ip to allow recursion

 

(4)add the port 5666 in apf or csf

Nagios setup

In Remote server

cd /root

wget http://www.mycutelife.net/sanju/newtickethelp/nagios_downloads/nagios-plugins-1.3.1.tar.gz

wget http://www.mycutelife.net/sanju/newtickethelp/nagios_downloads/nrpe-1.9.tar.gz

tar -zxvf nagios-plugins-1.3.1.tar.gz

cd nagios-plugins-1.3.1

./configure

make all

make install

cd ..

tar -zxvf nrpe-1.9.tar.gz

cd nrpe-1.9/

./configure

make all

cp nrpe.cfg /etc/nrpe.conf

chmod 777 /etc/nrpe.conf

cp src/check_nrpe /usr/sbin/

chmod 755 /usr/sbin/check_nrpe

cp src/nrpe /usr/sbin/

chmod 755 /usr/sbin/nrpe

wget http://www.mycutelife.net/sanju/newtickethelp/nagios_downloads/nrpe

cp nrpe /etc/xinetd.d/nrpe

/sbin/iptables -I INPUT -p tcp -s 0/0 –dport 5666 -j ACCEPT

/etc/init.d/iptables save

/usr/sbin/adduser nagios

echo “nrpe 5666/tcp # NRPE” >> /etc/services

/etc/rc.d/init.d/xinetd restart