问题原文
原帖链接 · 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:
- https://assets.nagios.com/downloads/nagioscore/docs/nagioscore/4/en/eventhandlers.html
- https://assets.nagios.com/downloads/nagioscore/docs/nagioscore/4/en/notifications.html
摘自公开归档,保留原文语言,版式经整理,外部媒体与邮箱地址已移除。
