centos 6.5 nagios監控安裝篇

來源:互聯網
上載者:User

標籤:nagios 監控伺服器安裝 監控用戶端安裝

一、Nagios服務端安裝

1、yum install –y httpd php mysql mysql-devel

2、伺服器端安裝nagios程式

wget http://sourceforge.net/projects/nagios/files/nagios-3.x/nagios-3.2.1/nagios-3.2.1.tar.gz/download

http://down1.chinaunix.net/distfiles/nagios-plugins-1.4.14.tar.gz

/usr/sbin/useraddnagios

tar zxvfnagios-3.2.1.tar.gz

cdnagios-3.2.1

./configure--prefix=/usr/local/nagios --with-command-group=nagios

make all

make install;makeinstall-init;make install-config;make install-commandmode ;make install-webconf

makeinstall //來安裝主程式,CGI和HTML檔案

makeinstall-init //在/etc/rc.d/init.d安裝啟動指令碼

makeinstall-config //來安裝樣本設定檔,安裝的路徑是/usr/local/nagios/etc

makeinstall-commandmode //來配置目錄許可權

makeinstall-webconf // 配置nagios跟apache整合

3、安裝Nagios-plugins外掛程式,監控用

tar zxvfnagios-plugins-1.4.14.tar.gz

cdnagios-plugins-1.4.14

./configure--prefix=/usr/local/nagios --with-nagios-user=nagios --with-nagios-group=nagios

make&& make install

4、伺服器端安裝nrpe,與用戶端通訊

tar -xzf nrpe-2.14.tar.gz

cd nrpe-2.14

./configure --enable-ssl --with-ssl-lib

make all

make install-plugin && make install-daemon&& make install-daemon-config

chown -R nagios.nagios /usr/local/nagios

5、nagios存取控制設定

htpasswd  -c /usr/local/nagios/etc/htpasswd.users nagiosadmin

輸入兩次密碼即可,登入頁面的時候會用到這個密碼.

6、重啟nagios、httpd服務

重啟前

/usr/local/nagios/bin/nagios-v /usr/local/nagios/etc/nagios.cfg 檢測是否正確

重啟nagios,/etc/init.d/nagios restart ;/etc/init.d/httpd restart ;

7、Nagios測試訪問 使用者名稱:nagiosadmin

http://localhost/nagios/ 如:

650) this.width=650;" src="http://s3.51cto.com/wyfs02/M01/74/1A/wKiom1YThBXgNqNHAAF-Orbhmxk500.jpg" title="QQ圖片20151006161811.jpg" alt="wKiom1YThBXgNqNHAAF-Orbhmxk500.jpg" />

點擊左側的Hosts可以看到右側預設localhost主機的監控,UP表示主機目前運行正常:

650) this.width=650;" src="http://s3.51cto.com/wyfs02/M01/74/18/wKioL1YTgc-BDOVpAAJAI1d0c1c348.jpg" title="2.png" alt="wKioL1YTgc-BDOVpAAJAI1d0c1c348.jpg" />

點擊左側的Services可以看到右側預設localhost監控的各個服務的狀態,綠色OK表示正常:

650) this.width=650;" src="http://s3.51cto.com/wyfs02/M01/74/1A/wKiom1YTgc6hcdjzAAYgGsu_Ytc065.jpg" title="3.png" alt="wKiom1YTgc6hcdjzAAYgGsu_Ytc065.jpg" />

取消650) this.width=650;" src="http://s3.51cto.com/wyfs02/M02/74/1A/wKiom1YTgeCgccE9AAAViyqjWVI343.jpg" title="4.png" alt="wKiom1YTgeCgccE9AAAViyqjWVI343.jpg" />大喇叭,

點擊大喇叭表徵圖-- Enable notifications forthis service

650) this.width=650;" src="http://s3.51cto.com/wyfs02/M02/74/18/wKioL1YTgf-z_OzjAAFoXHj4GfI571.jpg" title="5.png" alt="wKioL1YTgf-z_OzjAAFoXHj4GfI571.jpg" />

點commit

650) this.width=650;" src="http://s3.51cto.com/wyfs02/M00/74/1A/wKiom1YTgfbx7wIHAABqHCzYMAo446.jpg" title="6.png" alt="wKiom1YTgfbx7wIHAABqHCzYMAo446.jpg" />

 

Error:Could not opencommand file ‘/usr/local/nagios/var/rw/nagiosNaNd‘ for update! 錯誤提示沒有許可權,

授權這個檔案 chmod 777 /usr/local/nagios/var/rw/nagiosNaNd

出現錯誤:

HTTP WARNING:HTTP/1.1 403 Forbidden - 5159 bytes in 0.002 second response time(警告:HTTP HTTP / 1.1沒有許可權訪問此網站-0.002秒的回應時間5159個位元組)

建立網頁index.html並授權

chmod o+w/var/www/html/index.html

二、Nagios監控用戶端安裝

1、安裝nagios-plugins

useradd -s /sbin/nologin nagios

tar -xzf  nagios-plugins-1.4.14.tar.gz

cd nagios-plugins-1.4.14

./configure --prefix=/usr/local/nagios

&&make &&make install

2、用戶端安裝nrpe

tar -xzfnrpe-2.14.tar.gz && cd nrpe-2.14 &&

./configure--enable-ssl --with-ssl-lib &&

make all

makeinstall-plugin && make install-daemon && makeinstall-daemon-config

chown-R nagios:nagios /usr/local/nagios/

啟動nrpe用戶端命令:

/usr/local/nagios/bin/nrpe-c /usr/local/nagios/etc/nrpe.cfg -d

3、用戶端nrpe設定

vi  /usr/local/nagios/etc/nrpe.cfg

在allowed_hosts=127.0.0.1 欄位後面加上nagios伺服器端的IP地址

allowed_hosts=127.0.0.1,192.168.1.151或者allowed_hosts=127.0.0.1,192.168.1.0/24


本文出自 “linux菜鳥成長記” 部落格,請務必保留此出處http://9040429.blog.51cto.com/9030429/1700386

centos 6.5 nagios監控安裝篇

聯繫我們

該頁面正文內容均來源於網絡整理,並不代表阿里雲官方的觀點,該頁面所提到的產品和服務也與阿里云無關,如果該頁面內容對您造成了困擾,歡迎寫郵件給我們,收到郵件我們將在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.