How to install nags (version 3) in a Debian server and the nrpe client.

Server side

apt-get install -y nagios3 nagios-nrpe-plugin

usermod -a -G nagios www-data

chmod -R g+x /var/lib/nagios3/

sed -i ‘s/check_external_commands=0/check_external_commands=1/g’ / etc/nagios3/nagios.cfg

htpasswd -c /etc/nagios3/htpasswd.users nagiosadmin

service nagios3 restart && service apache2 restart

Client side

apt-get install -y nagios-plugins nagios-nrpe-server

Edit /etc/nagios/nrpe.cfg

log_facility=daemon
pid_file=/var/run/nagios/nrpe.pid
server_port=5666
nrpe_user=nagios
nrpe_group=nagios
allowed_hosts=xx.xx.xx.xx
dont_blame_nrpe=1

debug=0
command_timeout=60
connection_timeout=300
include=/etc/nagios/nrpe_local.cfg
include_dir=/etc/nagios/nrpe.d/

command[check_users]=/usr/lib/nagios/plugins/check_users -w 5 -c 10 command[check_load]=/usr/lib/nagios/plugins/check_load -w 15,10,5 -c 30,25,20
command[check_hda1]=/usr/lib/nagios/plugins/check_disk -w 20% -c 10% -p /dev/vda
command[check_zombie_procs]=/usr/lib/nagios/plugins/check_procs – w 5 -c 10 -s Z
command[check_total_procs]=/usr/lib/nagios/plugins/check_procs -w 150 -c 200

And

iptables -N NRPE

iptables -I INPUT -s 0/0 -p tcp –dport 5666 -j NRPE iptables -I NRPE -s xx.xx.xx.xx -j ACCEPT

iptables -A NRPE -s 0/0 -j DROP

iptables-save

service nagios-nrpe-server restart

Server

Edit /etc/nagios3/conf.d/example.com.cfg

define host {
use linux-server
host_name example.com
alias ikigai
address xx.xx.xx.xx
}

define service {
use generic-service
host_name example.com
service_description PING
check_command check_fping!100.0,20%!500.0,60%
}

define service{
use generic-service
host_name example.com
service_description Current Load
check_command check_nrpe!check_load!5.0,4.0,3.0!10.0,6.0,4.0
}

define service{
use generic-service
host_name example.com
service_description Total Processes
check_command check_nrpe!check_procs!300!450!RSDT
}

define service{
use generic-service
host_name example.com
service_description Zombie Processes
check_command check_nrpe!check_zombie_procs!1 5
}

define service{
use generic-service
host_name example.com
service_description SWAP usage
check_command check_nrpe!check_swap
}

service nagios3 restart

Advertisements

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Google+ photo

You are commenting using your Google+ account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s