Statement
The Stars last night
Blog:http://yestreenstars.blog.51cto.com/
This article by oneself creation, if need reprint, please indicate source, thank cooperation!
Objective
Automate the installation of Nagios clients with one click.
Environment
Os:centos 6.2 32
nagios-plugins:2.0.3
nrpe:2.15
configure
#!/bin/bash# script name: one-key automatic install nagios client# author: yestreenstars# create time: 2014-08-08nagios_server_ip= "192.168.1.88" # Change this to your nagios server ' s ip.echo -n '--Install related software ... "Yum -y install wget openssl openssl-devel > /dev/null 2>&1 && echo "completed!" echo -n "--install nagios-plugins ..." useradd -m -s /sbin/nologin nagioswget -p /tmp http://nagios-plugins.org/download/nagios-plugins-2.0.3.tar.gz > /dev/ null 2>&1 | | (echo "failure!" && exit) tar xzf /tmp/nagios-plugins-2.0.3.tar.gz -c /usr/src/cd / USR/SRC/NAGIOS-PLUGINS-2.0.3/(./configure && make && make install) > /dev/null 2>&1 && echo "completed!" echo -n "--installing nrpe ..." wget -p /tmp http://sourceforge.net/projects/ nagios/files/nrpe-2.x/nrpe-2.15/nrpe-2.15.tar.gz > /dev/null 2>&1 | | (echo "failure!" && exit) tar xzf /tmp/nrpe-2.15.tar.gz -c /usr/src/cd /usr/src/ NRPE-2.15/(./configure &&make all &&make install-plugin && Make install-daemon &&make install-daemon-config) > /dev/null 2> &1 && echo "completed!" chown -r nagios:nagios /usr/local/nagios/echo -n "--setting nrpe ..." sed -i '/^allowed_hosts=/s/$/, ' $nagios _server_ip '/' /usr/local/nagios/etc/nrpe.cfg/usr/local/nagios/bin/ nrpe -c /usr/local/nagios/etc/nrpe.cfg -d echo "/usr/local/nagios/bin/nrpe&nbSp;-c /usr/local/nagios/etc/nrpe.cfg -d " >> /etc/rc.localiptables -i input -p tcp --dport 5666 -j acceptservice iptables save > / dev/null 2>&1 && echo "completed!"
This article is from the "Last Night Stars" blog, please make sure to keep this source http://yestreenstars.blog.51cto.com/1836303/1537255