Use of Linux monitoring platform Nagios (iii) Environment deployment on the monitored side

Source: Internet
Author: User
Tags chmod create database install perl linux

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 }

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.