There are 2 main types of surveillance this time:
1.web Server
2.mysql Server
So first of all to ensure that Nginx/apache or MySQL service startup;
The following is the function Installmysql () script for the MySQL Monitor-side deployment:
Installmysql () {Yum Install xinetd-y service xinetd start CD $path useradd-s/sbin/nologin TAR-ZXVF nagios-plugins-1.4.14.tar.gz cd nagios-plugins-1.4.14./configure--prefix= $nagiospath--with-na
Gios-user=nagios--with-nagios-group=nagios make make install CD $path TAR-ZXVF nrpe-2.12.tar.gz CD nrpe-2.12./configure make all make install make install-plugin make Install-daemon Mak E install-daemon-config make install-xinetd read-p "Please input the Nagios server IP:" ServerIP echo "n RPE 5666/tcp #nrpe ">>/etc/services sed-i" s#only_from.* #only_from = 127.0.0.1 $serverip # "/etc/xinetd.d/nrpe chkconfig--add xinetd chkconfig xinetd on CD $path TAR-ZXVF check_mysql_health-2.1.tar.gz CD check_mysql_health-2.1./configure--prefix=/usr/local/nagios--with-nagios-us Er=nagios--with-nagios-Group=nagios--with-perl=/usr/bin/perl make make install yum install PERL-DBI perl-dbd-mysql-y CD $ Path TAR-ZXVF check_iftraffic.tar.gz chmod +x check_iftraffic chmod +x check_mem.sh chmod +x u.sh chmod +x ip_conn.sh CP check_mem.sh/usr/local/nagios/libexec CP Check_cpu.sh/usr/local/nagios/libexe C CP check_iftraffic/usr/local/nagios/libexec CP ip_conn.sh/usr/local/nagios/libexec READ-P "please Inpu t the MySQL password: "mysqlpwd read-p" please input the Nagios for MySQL ' s password: "Nagiospwd mysql-uroot
-P$MYSQLPWD-E "CREATE database Nagios;"
Mysql-uroot-p$mysqlpwd-e "Grant Select on nagios.* to nagios@ ' $serverip ' identified by ' $nagiospwd ';"
MYSQL-UROOT-P$MYSQLPWD-E "flush privileges;"
CP $path/cfg/nrpe.cfg/usr/local/nagios/etc/chown-r nagios.nagios/usr/local/nagios service xinetd restart echo "##############################" echo "#########**the Result**####### "lsof-i:5666 echo"------------------------------"/usr/local/nagios/libexec/check_nrpe-h localhost }