nagios的被監控端配置

來源:互聯網
上載者:User

完成了nagios的伺服器端的設定後,則需要在被監控主機端做相關設定,設定一些監控參數值。

更多精彩內容:http://www.bianceng.cnhttp://www.bianceng.cn/soft/tools/

完整的配置指令碼如下:

#!/bin/bash #auto configure nagios linux client side #2012-12-05      nagios_dir="/usr/local/nagios"nagiosrv="192.168.0.50"     function Install_nagios() {      yum -y install install gcc gcc-c++ autoconf libjpeg libjpeg-devel libpng libpng-devel freetype freetype-devel libxml2 libxml2-devel zlib zlib-devel glibc glibc-devel glib2 glib2-devel bzip2 bzip2-devel ncurses ncurses-devel curl curl-devel e2fsprogs e2fsprogs-devel krb5-devel libidn libidn-devel openssl* openssl-devel nss_ldap openldap openldap-devel  openldap-clients openldap-servers libxslt-devel libevent-devel ntp  libtool-ltdl bison libtool vim-enhanced gd*           useradd nagios            cd /usr/local/src           tar zxvf nagios-plugins-1.4.16.tar.gz      tar zxvf nrpe-2.13.tar.gz           cd /usr/local/src/nagios-plugins-1.4.16  #編譯安裝nagios外掛程式包     ./configure --prefix=$nagios_dir      make;make install           chown -R nagios:nagios $nagios_dir           cd /usr/local/src/nrpe-2.13  #編譯安裝nrpe包     ./configure      make all      make install-plugin      make install-daemon      make install-daemon-config }      function Set_nagios() {      cd $nagios_dir/etc/      sed -i.bak '/server_address/ s/^#//' nrpe.cfg  #修改主機的nrpe設定檔     sed -i '/server_address/ s/=.*$/=0.0.0.0/' nrpe.cfg      sed -i '/allowed_hosts/ s/^.*$/&, '$nagiosrv'/' nrpe.cfg                    sed -i '205acommand[check_disk]=/usr/local/nagios/libexec/check_disk -w 15% -c 5% -p / -p /boot' nrpe.cfg  #追加監控磁碟容量的命令     sed -i '206acommand[check_swap]=/usr/local/nagios/libexec/check_swap -w 30% -c 10%' nrpe.cfg  #追加監控swap容量的命令         }      function Restart_nagios()  #重啟nrpe服務{      kill -9 `cat /var/run/nrpe.pid` > /dev/null 2>&1      $nagios_dir/bin/nrpe -c $nagios_dir/etc/nrpe.cfg -d }      case $1 ininstall)      Install_nagios      ;; config)      Set_nagios      ;; restart)      Restart_nagios      ;; *)      echo "Usage sh nagiosclient.sh {install|config|restart}"      ;; esac

本文出自 “努力為之” 部落格,請務必保留此出處http://carllai.blog.51cto.com/1664997/1085691

相關文章

E-Commerce Solutions

Leverage the same tools powering the Alibaba Ecosystem

Learn more >

Apsara Conference 2019

The Rise of Data Intelligence, September 25th - 27th, Hangzhou, China

Learn more >

Alibaba Cloud Free Trial

Learn and experience the power of Alibaba Cloud with a free trial worth $300-1200 USD

Learn more >

聯繫我們

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

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