Skip to content

Instantly share code, notes, and snippets.

@shaon
Last active December 19, 2015 22:28
Show Gist options
  • Save shaon/b46be3dcce9f72ec1d8e to your computer and use it in GitHub Desktop.
Save shaon/b46be3dcce9f72ec1d8e to your computer and use it in GitHub Desktop.
Ganglia/Nagios client setup for QA cloud
#!/bin/bash
SERVERIP=""
if [ "$1" == "" ];
then
read -p "Please provide Ganglia/Nagios server IP: " SERVERIP
else
SERVERIP=$1
fi
########################
# Ganglia Client Setup #
########################
yum install http://dl.fedoraproject.org/pub/epel/6/x86_64/epel-release-6-8.noarch.rpm -y
yum install ganglia ganglia-gmond -y
wget https://gist.github.com/mdshaonimran/1c34eb9403f52a9411a5/raw/dcc9166bbd77102a4961d172ecaaa1fa265a0d99/gmond.conf -O /etc/ganglia/gmond.conf
sed -i "s/10.104.3.128/$SERVERIP/" /etc/ganglia/gmond.conf
chkconfig gmetad off
service gmetad stop
chkconfig gmond on
service gmond start
#######################
# Nagios Client Setup #
#######################
yum install nrpe nagios-plugins-all nagios-plugins-nrpe -y
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
sed -i "s/10.104.3.128/$SERVERIP/" /etc/nagios/nrpe.cfg
chkconfig nagios off
service nagios stop
chkconfig nrpe on
service nrpe start
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment