大网数据广告活动
服务器运维问答

Writing nagios service acknowledgement to system file

· 52CE 我爱测

I use nagios heavily to monitor many servers and services and rely on it daily. As of right now all services get written to the system log (currently CentOS 6.9) and sys admins get notified when services are failing. However, ser…

问题原文

原帖链接 · Ed Dunn · CC BY-SA 3.0

I use nagios heavily to monitor many servers and services and rely on it daily. As of right now all services get written to the system log (currently CentOS 6.9) and sys admins get notified when services are failing. However, services that have been acknowledged still write to the system log and so I am constantly being notified by services that I have already acknowledged. Is there a way to add ACKNOWLEDGED to the log entry so that I may filter them out via logcheck? Here is an example of the current log entry:

Aug 16 00:00:00 nagios[4711]: CURRENT SERVICE STATE: ;Apache Servers;CRITICAL;HARD;4;CRITICAL - Socket timeout

And what I would like to accomplish is:

Aug 16 00:00:00 nagios[4711]: CURRENT SERVICE STATE: ACKNOWLEDGED; Apache Servers;CRITICAL;HARD;4;CRITICAL - Socket timeout

or something similar.

I will also be posting this to Nagios forums so please disregard any cross posts.

已采纳解答

原帖链接 · Diego Roccia · CC BY-SA 3.0

Your way of managing alerts is pretty odd. I mean, Nagios has its own notification mechanism that works pretty well, you don't need to check the logs. But if you want to keep on with your approach, I can see 3 solutions:

  • Patching the source. This is really not the route I would take. Moreover, if you change the logs format you will end up breaking the reporting pages, since they use the logs as source of informations
  • creating a fake contact with a notification script that parses the event and write to a log file with all the informations you want/need
  • the same as above, but using an Event Handler (I would go with this)

some info from Nagios documentation:

摘自公开归档,保留原文语言,版式经整理,外部媒体与邮箱地址已移除。

资料来源与适用范围

资料来源
Server Fault
适用范围
以原帖系统、软件版本与发布日期为准(2017-08-30)
内容语言
中文;命令、路径和错误标识保留技术原文
本地收录日期
2026-11-15
授权说明
CC BY-SA 3.0

正文与所需资源由本站本地存储。查看来源及更新记录 ↗

请按适用版本和实际日志确认原因;本站没有对每一种系统或设备逐项执行文中的操作。