標籤:監控 nagios nrpe
1.Nrpe安裝
建立 nagios使用者
useradd nagios
1.1被監控伺服器安裝nagios外掛程式
tar xzvfnagios-plugins-1.4.15.tar.gz
cd nagios-plugins-1.4.15
./configure
make
make install
1.2被監控伺服器安裝nrpe程式
tar xzvf nrpe-2.1.2.tar.gz
cd nrpe-2.1.2
./configure --prefix=/usr/local/nagios
make all
make install-plugin
make install-daemon
make install-daemon-config
檢查外掛程式安裝
ll /usr/local/nagios/libexec/
1.3修改nrpe設定檔,加入允許的IP
#vi/usr/local/nagios/etc/nrpe.cfg
allowed_hosts=127.0.0.1,192.169.0.201
啟動nrpe
#/usr/local/nagios/bin/nrpe -c/usr/local/nagios/etc/nrpe.cfg –d
# netstat -plnt |grep nrpe
tcp 0 0 0.0.0.0:5666 0.0.0.0:* LISTEN 16831/nrpe
1.4加入開機自啟動
echo‘/usr/local/nagios/bin/nrpe -c /usr/local/nagios/etc/nrpe.cfg -d‘>>/etc/rc.local
1.5在主Nagios上驗證用戶端nrpe是否安裝好
[[email protected] src]#/usr/local/nagios/libexec/check_nrpe -H 192.168.1.100
NRPE v2.12
若出現版本號碼,代表nrpe用戶端安裝成功。
2主Nagios調用nrpe配置2.1編輯用戶端上的nrpe設定檔
#vi /usr/local/nagios/etc/nrpe.cfg
command[check_users]=/usr/local/nagios/libexec/check_users-w 5 -c 10
command[check_load]=/usr/local/nagios/libexec/check_load-w 15,10,5 -c 30,25,20
2.2在主Nagios上定義用戶端主機
#vi /usr/local/nagios/etc/objects/hosts.cfg
define host{
use linux-server,host-pnp
host_name hostb
alias hostb
address 192.168.1.100
}
2.3在主Nagios上佈建服務
#vi /usr/local/nagios/etc/objects/services.cfg
define service{
use generic-service,srv-pnp
host_name hostb
service_description check_users
check_command check_nrpe!check_users
max_check_attempts 5
normal_check_interval 1
}
define service{
use generic-service,srv-pnp
host_name hostb
service_description check_load
check_command check_nrpe!check_load
max_check_attempts 5
normal_check_interval 1
}
2.4重啟主Nagios服務
#/etc/init.d/nagios checkconfig
#/etc/init.d/nagios restart
2.5 Nagios介面臨控
650) this.width=650;" src="http://s3.51cto.com/wyfs02/M01/26/8F/wKioL1NrZOPBCgaaAABkYNrkfiQ950.jpg" title="T9RY_VE[S[S`]2}L(X8L2_F.jpg " alt="wKioL1NrZOPBCgaaAABkYNrkfiQ950.jpg" />
本文出自 “此心安處是吾鄉” 部落格,轉載請與作者聯絡!