naemon / naemon-core

Networks, Applications and Event Monitor
http://www.naemon.io/
GNU General Public License v2.0
153 stars 63 forks source link

Feature global notification handler #477

Closed sni closed 1 month ago

sni commented 1 month ago

Add global notification handler in the same way as global event handlers. It adds 2 new global options:

which will be run each time a normal notification would be considered. It does not require contacts for hosts and services. If used it will also prevent warnings if hosts/services do not have contacts set. The global notification handlers do not have any contact macros set, because they are independent of contacts.

This PR also adds another global option:

This option can be used to suppress a log entry each time the global notification handler is run.

Finally this PR adds a new generic external command

It can be used to add custom log entries to the main naemon log file. For example to add the actual notified contacts to the log file.

ex.:

printf "[%lu] LOG;SERVICE NOTIFICATION: test contact;testhost;test service;CRITICAL;notify-by-email;test message\n" `date +%s` >> .../tmp/run/naemon.cmd

which would add a log entry similar to a normal notification. The actual hosts/services/contacts and commands don't have to exist.

Or other notes like ex.:

printf "[%lu] LOG;SERVICE NOTE: testhost;event handler restarted service successfully\n" `date +%s` >> .../tmp/run/naemon.cmd
github-advanced-security[bot] commented 1 month ago

This pull request sets up GitHub code scanning for this repository. Once the scans have completed and the checks have passed, the analysis results for this pull request branch will appear on this overview. Once you merge this pull request, the 'Security' tab will show more code scanning analysis results (for example, for the default branch). Depending on your configuration and choice of analysis tool, future pull requests will be annotated with code scanning analysis results. For more information about GitHub code scanning, check out the documentation.