nagios監控配置與郵件告警
ip主機名
備註172.16.121.227
nagios
服務端172.16.121.228
client
客戶端這裡還需要安裝nagios服務以及外掛程式可以參考我之前的部落格:
1.先設定服務端
[root@nagios ~]# vi /usr/local/nagios/etc/nrpe.cfg
修改和新增2條命令
allowed_hosts=127.0.0.1,::1,172.16.121.0/24 加上監控網段
command[check_nagios]=/usr/local/nagios/libexec/check_nagios -e 5 -f /usr/local/nagios/var/status.dat -c /usr/local/nagios/bin/nagios
2.配置客戶端
這裡先測試服務端配置是否正常
[root@client ~]# cd /usr/local/nagios/libexec/
[root@client libexec]# ./check_nrpe -h 172.16.121.227
nrpe v3.1.0-rc1
[root@client libexec]# ./check_nrpe -h 172.16.121.227 -c check_nagios
nagios ok: 6 processes, status log updated 1 second ago
複製相關文件到/usr/local/nagios/libexec/eventhandlers/下
cd /root/wjh/nagios-4.3.1/contrib/eventhandlers/
cp enable_notifications /usr/local/nagios/libexec/eventhandlers/
cp disable_notifications /usr/local/nagios/libexec/eventhandlers/
cp redundancy-scenario1/handle-master-host-event /usr/local/nagios/libexec/eventhandlers/
cp redundancy-scenario1/handle-master-proc-event /usr/local/nagios/libexec/eventhandlers/
sed -i 's/active_service_checks/notifications/g' /usr/local/nagios/libexec/eventhandlers/handle-master-proc-event
chown nagios.nagios /usr/local/nagios/libexec/eventhandlers/*
chmod 755 /usr/local/nagios/libexec/eventhandlers/*
修改/usr/local/nagios/etc/objects/commands.cfg檔案
define command
define command
define command
修改主機檔案/usr/local/nagios/etc/objects/localhost.cfg
define host
define service
修改模板檔案 /usr/local/nagios/etc/objects/templates.cfg
[root@client eventhandlers]# vi /usr/local/nagios/etc/objects/templates.cfg
define host
define service
修改 /usr/local/nagios/etc/nagios.cfg
enable_notifications=0
use_retained_program_state=0
到這裡監控服務端的配置基本完成重啟兩台的nagios服務
告警配置失敗
nagios設定郵件告警
搭建nagios的目的就是為了他的報警系統,nagios據我所了解可以有三種報警 一 聲音報警 二 電子郵件報警 三 手機短訊報警 四 傳真告警 下面是我的郵件報警的配置過程 1 開啟系統自帶的sendmail郵件系統 service sendmail start 如果沒有安裝,可以yum一下 yu...
Postfix 佇列監控告警,傳送告警郵件
設定監控的最大佇列數,當postfix佇列數超過設定警戒值自動傳送告警郵件給相關運維管理人員 bin bash 佇列目錄 queue dir naes incoming active bounce defer deferred corrupt hold trace admin 15801509423...
Zabbix 配置郵件告警
pre 1.對監控項增加trigger 2.server端安裝郵件服務 yum install sendmail 安裝 service sendmail start 啟動 chkconfig sendmail on 設定開機啟動 yum install postfix service postfix...