Tuesday, December 13, 2016

Nagios NRPE Script though Installation on Client


#!/bin/bash
########## Author Shrikant Mohinkar ##########
/bin/echo "NAGIOS CLIENT INSTALATION STARTED"
/usr/bin/yum install gcc wget glibc glibc-common gd gd-devel make net-snmp openssl-devel -y
useradd nagios
echo "nagios123" |passwd nagios --stdin
###############
mkdir -p /root/nagios
cd /root/nagios
/usr/bin/wget http://www.nagios-plugins.org/download/nagios-plugins-2.1.1.tar.gz
/usr/bin/wget https://sourceforge.net/projects/nagios/files/nrpe-2.x/nrpe-2.15/nrpe-2.15.tar.gz
###############
cd /root/nagios
tar xzf nagios-plugins-2.1.1.tar.gz
###############
cd /root/nagios/nagios-plugins-2.1.1
./configure
make
make install
###############
/usr/bin/chown nagios.nagios /usr/local/nagios
/usr/bin/chown -R nagios.nagios /usr/local/nagios/libexec
sleep 5
yum install xinetd -y
cd /root/nagios
tar xzf nrpe-2.15.tar.gz
cd /root/nagios/nrpe-2.15
./configure
make all
make install-plugin
make install-daemon
make install-daemon-config
make install-xinetd
sleep 5
/bin/sed -i 's/127.0.0.1/127.0.0.1 localhost 203.97.48.107/g' /etc/xinetd.d/nrpe
/bin/echo "nrpe 5666/tcp #NRPE" >> /etc/services
service xinetd start
chkconfig xinetd on
/bin/netstat -at | grep nrpe
/usr/local/nagios/libexec/check_nrpe -H localhost
/bin/echo "NAGIOS CLIENT SUCCESSFULLY INSTALLED "

No comments:

Post a Comment