linux監控平台nagios的使用(三)被監控端的環境部署

來源:互聯網
上載者:User

這次被監控主要有2種:

1.web伺服器

2.mysql伺服器

所以得先保證nginx/apache 或者mysql服務的啟動;

下面是mysql監控端部署的函數installmysql () 指令碼如下

installmysql () {     yum install xinetd -y     service xinetd start     cd $path     useradd -s /sbin/nologin nagios     tar -zxvf nagios-plugins-1.4.14.tar.gz     cd nagios-plugins-1.4.14     ./configure --prefix=$nagiospath --with-nagios-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     make install-daemon-config     make install-xinetd     read -p " Please input the nagios server IP: " serverip     echo "nrpe            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-user=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 check_cpu.sh     chmod +x ip_conn.sh     cp check_mem.sh /usr/local/nagios/libexec     cp check_cpu.sh /usr/local/nagios/libexec     cp check_iftraffic /usr/local/nagios/libexec     cp ip_conn.sh /usr/local/nagios/libexec     read -p "please input 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     }

聯繫我們

該頁面正文內容均來源於網絡整理,並不代表阿里雲官方的觀點,該頁面所提到的產品和服務也與阿里云無關,如果該頁面內容對您造成了困擾,歡迎寫郵件給我們,收到郵件我們將在5個工作日內處理。

如果您發現本社區中有涉嫌抄襲的內容,歡迎發送郵件至: info-contact@alibabacloud.com 進行舉報並提供相關證據,工作人員會在 5 個工作天內聯絡您,一經查實,本站將立刻刪除涉嫌侵權內容。

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.