Last active
December 19, 2015 11:29
-
-
Save shaon/743b77ec8cb22da75702 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# disable selinux | |
# fix/disable iptables | |
################# | |
# Nagios Server # | |
################# | |
yum install nagios nagios-plugins-all nagios-plugins-nrpe nrpe -y | |
chkconfig nagios on | |
chkconfig nrpe on | |
chkconfig httpd on | |
htpasswd -c /etc/nagios/passwd nagiosadmin | |
vim /etc/nagios/nagios.cfg | |
# uncomment this line | |
cfg_dir=/etc/nagios/servers | |
# create directory | |
mkdir /etc/nagios/servers | |
# set the following to /etc/nagios/objects/commands.cfg | |
vim /etc/nagios/objects/commands.cfg | |
define command { | |
command_name check_nrpe | |
command_line /usr/lib64/nagios/plugins/check_nrpe -H $HOSTADDRESS$ -c $ARG1$ | |
} | |
# configure client on nagios server | |
vim /etc/nagios/conf.d/server1.cfg | |
define host { | |
use linux-server | |
host_name server1 | |
address 10.104.3.129 | |
} | |
define service { | |
use generic-service | |
host_name server1 | |
service_description PING | |
check_command check_ping!100.0,20%!500.0,60% | |
} | |
define service { | |
use generic-service | |
host_name server1 | |
service_description SSH | |
check_command check_ssh | |
notifications_enabled 0 | |
} | |
define service { | |
use generic-service | |
host_name server1 | |
service_description Current Load | |
check_command check_local_load!5.0,4.0,3.0!10.0,6.0,4.0 | |
} | |
define service{ | |
use generic-service | |
host_name server1 | |
service_description Root Partition | |
check_command check_nrpe!check_disk | |
} | |
define service{ | |
use generic-service | |
host_name server1 | |
service_description Total Processes | |
check_command check_nrpe!check_procs | |
} | |
touch /var/www/html/index.html | |
chmod 755 /var/www/html/index.html | |
service httpd start | |
service nagios start | |
################# | |
# Nagios Client # | |
################# | |
yum install nrpe nagios-plugins-all nagios-plugins-nrpe -y | |
# modify nrpe config file | |
vim /etc/nagios/nrpe.cfg | |
cat > /etc/nagios/nrpe.cfg <<EOF | |
log_facility=daemon | |
pid_file=/var/run/nrpe/nrpe.pid | |
server_port=5666 | |
nrpe_user=nrpe | |
nrpe_group=nrpe | |
allowed_hosts=10.104.3.128 | |
dont_blame_nrpe=1 | |
allow_bash_command_substitution=0 | |
debug=0 | |
command_timeout=60 | |
connection_timeout=300 | |
include_dir=/etc/nrpe.d/ | |
command[check_users]=/usr/lib64/nagios/plugins/check_users -w 5 -c 10 | |
command[check_load]=/usr/lib64/nagios/plugins/check_load -w 15,10,5 -c 30,25,20 | |
command[check_disk]=/usr/lib64/nagios/plugins/check_disk -w 20% -c 10% -p / | |
command[check_procs]=/usr/lib64/nagios/plugins/check_procs -w 150 -c 200 -s RSZDT | |
command[check_zombie_procs]=/usr/lib64/nagios/plugins/check_procs -w 5 -c 10 -s Z | |
command[check_total_procs]=/usr/lib64/nagios/plugins/check_procs -w 150 -c 200 | |
EOF | |
chkconfig nrpe on | |
service nrpe start | |
# gotchas | |
1. If HTTP service on localhost is showing warning, create index.html file and set the right permission | |
touch /var/www/html/index.html | |
chmod 755 /var/www/html/index.html | |
2. PING, SSH might take a little longer to get green | |
3. Check NRPE connectivity, /usr/lib64/nagios/plugins/check_nrpe -H 10.104.3.129 |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment