mirror of
https://github.com/elastic/logstash.git
synced 2025-04-24 14:47:19 -04:00
- fix nagios output (refactor for new event methods, etc)
This commit is contained in:
parent
1bb463ae2e
commit
b24d4cab8f
1 changed files with 3 additions and 4 deletions
|
@ -109,13 +109,12 @@ class LogStash::Outputs::Nagios < LogStash::Outputs::Base
|
|||
end
|
||||
end
|
||||
|
||||
cmd = "[#{Time.now.to_i}] PROCESS_SERVICE_CHECK_RESULT;#{host[0]};#{service[0]};#{level};"
|
||||
cmd = "[#{Time.now.to_i}] PROCESS_SERVICE_CHECK_RESULT;#{host};#{service};#{level};"
|
||||
if annotation
|
||||
cmd += "#{annotation[0]}: "
|
||||
cmd += "#{annotation}: "
|
||||
end
|
||||
cmd += "#{event.source}: "
|
||||
# In the multi-line case, escape the newlines for the nagios command file
|
||||
cmd += event.message.gsub("\n", "\\n")
|
||||
cmd += (event["message"] || "<no message>").gsub("\n", "\\n")
|
||||
|
||||
@logger.debug("Opening nagios command file", :commandfile => @commandfile,
|
||||
:nagios_command => cmd)
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue