1.在監(jiān)控機(jī)上安裝NRPE
tar -zxvf nrpe-2.12.tar.gz
cd nrpe-2.12
./configure
make all
make install-plugin
2.在被監(jiān)控機(jī)上安裝nagios插件和NRPE
(1).先增加nagios用戶:
useradd nagios
(2.)安裝nagios插件:
tar -zxvf nagios-plugins-1.4.14.tar.gz
cd nagios-plugins-1.4.14
./configure --prefix=/usr/local/nagios
make
make install
(3).安裝nrpe:
tar -zxvf nrpe-2.12.tar.gz
cd nrpe-2.12
./configure --prefix=/usr/local/nagios
make all
make install-plugin
make install-daemon
make install-daemon-config
make install-xinetd nrpe安裝為xinetd服務(wù)
(4).編輯nrpe配置文件,增加監(jiān)控機(jī)地址:
#vi /etc/xinetd.d/nrpe
only_from = 192.168.18.100
(5).修改services文件,增加端口
#vi /etc/services
nrpe 5666/tcp #NRPE
(6).重啟xinetd服務(wù)
service xinetd restart
(7).查看服務(wù)是否啟動
#/usr/local/nagios/libexec/check_nrpe -H localhost
NRPE v2.12
如果出現(xiàn)Connection refused by host 需要安裝yum intall openssl*
至此被監(jiān)控機(jī)上的操作就結(jié)束了,如果有需要增加監(jiān)控項(xiàng),需修改/etc/xinetd.d/nrpe文件。
3.修改監(jiān)控機(jī)上commands.cfg文件,增加check_nrpe的定義:
define command{
command_name check_nrpe
command_line $USER1$/check_nrpe -H $HOSTADDRESS$ -c $ARG1$
}
4.在監(jiān)控機(jī)上測試與被監(jiān)控機(jī)的通訊是否正常:
[root@test1 objects]# /usr/local/nagios/libexec/check_nrpe -H localhost -c check_load
OK - load average: 0.05, 0.06, 0.00|load1=0.050;15.000;30.000;0; load5=0.060;10.000;25.000;0; load15=0.000;5.000;20.000;0;
能夠正常獲取信息。
vim /usr/local/nagios/etc/nrpe.cfg
修改 allowed_hosts=192.168.18.100(監(jiān)控機(jī))
增加
command[check_sda2]=/usr/local/nagios/libexec/check_disk -w 20% -c 10% -p /dev/sda2 --意思是監(jiān)控第二個分區(qū)
command[check_swap]=/usr/local/nagios/libexec/check_swap -w 20% -c 10% -監(jiān)控內(nèi)存
修改監(jiān)控機(jī)的services.cfg
增加需要監(jiān)控的服務(wù)
5.修改服務(wù)配置文件:
增加:
define service {
host_name wangbo
max_check_attempts 5
check_period 24x7
notification_interval 10
normal_check_interval 1
retry_check_interval 1
service_description checkdisk2
check_command check_nrpe!check_sda2 ###########監(jiān)控第二個硬盤
notification_period 24x7
notification_options w,u,c,r
contact_groups tomasgroup
}
define service {
host_name wagbo
max_check_attempts 5
check_period 24x7
notification_interval 10
normal_check_interval 1
retry_check_interval 1
service_description checkLoad
check_command check_nrpe!check_load ########### 監(jiān)控CPU負(fù)載
notification_period 24x7
notification_options w,u,c,r
contact_groups tomasgroup
}
define service {
host_name wangbo
max_check_attempts 5
check_period 24x7
notification_interval 10
normal_check_interval 1
retry_check_interval 1
service_description checkswap
check_command check_nrpe!check_swap 監(jiān)控內(nèi)存
notification_period 24x7
notification_options w,u,c,r
contact_groups tomasgroup }
另外有需要云服務(wù)器可以了解下創(chuàng)新互聯(lián)scvps.cn,海內(nèi)外云服務(wù)器15元起步,三天無理由+7*72小時(shí)售后在線,公司持有idc許可證,提供“云服務(wù)器、裸金屬服務(wù)器、高防服務(wù)器、香港服務(wù)器、美國服務(wù)器、虛擬主機(jī)、免備案服務(wù)器”等云主機(jī)租用服務(wù)以及企業(yè)上云的綜合解決方案,具有“安全穩(wěn)定、簡單易用、服務(wù)可用性高、性價(jià)比高”等特點(diǎn)與優(yōu)勢,專為企業(yè)上云打造定制,能夠滿足用戶豐富、多元化的應(yīng)用場景需求。
網(wǎng)頁標(biāo)題:使用nagios監(jiān)控io,內(nèi)存-創(chuàng)新互聯(lián)
轉(zhuǎn)載注明:http://chinadenli.net/article42/dhjjhc.html
成都網(wǎng)站建設(shè)公司_創(chuàng)新互聯(lián),為您提供用戶體驗(yàn)、動態(tài)網(wǎng)站、網(wǎng)站設(shè)計(jì)公司、全網(wǎng)營銷推廣、網(wǎng)站策劃、網(wǎng)站收錄
聲明:本網(wǎng)站發(fā)布的內(nèi)容(圖片、視頻和文字)以用戶投稿、用戶轉(zhuǎn)載內(nèi)容為主,如果涉及侵權(quán)請盡快告知,我們將會在第一時(shí)間刪除。文章觀點(diǎn)不代表本網(wǎng)站立場,如需處理請聯(lián)系客服。電話:028-86922220;郵箱:631063699@qq.com。內(nèi)容未經(jīng)允許不得轉(zhuǎn)載,或轉(zhuǎn)載時(shí)需注明來源: 創(chuàng)新互聯(lián)
猜你還喜歡下面的內(nèi)容