最近我写了关于naigos监控的安装与配置的技术文档,公司运维按照我的文档部署naigos,发现不能发送报警邮件,经过我的检查,发现问题如下:
1、hosts里的配置
- [root@nagios ~]# cat /etc/hosts
- # Do not remove the following line, or various programs
- # that require network functionality will fail.
- 127.0.0.1 localhost.localdomain localhost
- ::1 localhost6.localdomain6 localhost6
- 172.16.4.3 nagios.com nagios ##一定要有本机的ip对应
2
、hostname与/etc/sysconfig/network里的hostname一致,并与hosts里的一致
3、去nagios的web里,选择报警的服务(如果httpd),
点击http旁边的这个摁钮,如果你看到notification状态为disabled 那么你可以选择右侧的,然后选择commit 。出现下面对话框
下面查看一下nagios.log里的日志
- [root@nagios var]# tail -f nagios.log
- [1326419317] Auto-save of retention data completed successfully.
- [1326422917] Auto-save of retention data completed successfully.
- [1326424408] EXTERNAL COMMAND: ENABLE_SVC_NOTIFICATIONS;henan-cunchu;HTTP
- [1326424434] Caught SIGTERM, shutting down...
- [1326424434] Successfully shutdown... (PID=6823)
- [1326424434] Nagios 3.3.1 starting... (PID=25398)
- [1326424434] Local time is Fri Jan 13 11:13:54 CST 2012
- [1326424434] LOG VERSION: 2.0
- [1326424434] Finished daemonizing... (New PID=25399)
- [1326424464] SERVICE NOTIFICATION: nagiosadmin;henan-cunchu;HTTP;CRITICAL;notify-service-by-email;?.?杩..
如果内容有service notification这样的话,就代表nagios发送了邮件报警,下面是我接收到的报警邮件
就代表你启动了这个http服务的报警了,这一步完成之后等待10s左右,刷新页面就能看看notification的状态变为enabled,而且能收到报警,其他的服务也类似这样操作。
本文转自 dl528888 51CTO博客,原文链接:
http://blog.51cto.com/dl528888/763079
,如需转载请自行联系原作者