The Nagios output is used for sending passive check results to Nagios via the Nagios command file. This output currently supports Nagios 3.
For this output to work, your event must have the following Logstash event fields:
nagios\_host
nagios\_service
These Logstash event fields are supported, but optional:
nagios\_annotation
nagios\_level
(overrides nagios\_level
configuration option)There are two configuration options:
commandfile
- The location of the Nagios external command file. Defaults
to ‘/var/lib/nagios3/rw/nagios.cmd’nagios\_level
- Specifies the level of the check to be sent. Defaults to
CRITICAL and can be overriden by setting the “nagios_level” field to one
of “OK”, “WARNING”, “CRITICAL”, or “UNKNOWN”
output{ if [message] =~ /(error|ERROR|CRITICAL)/ { nagios { # your config here } } }
output {
nagios {
codec => ... # codec (optional), default: "plain"
commandfile => ... # a valid filesystem path (optional), default: "/var/lib/nagios3/rw/nagios.cmd"
nagios_level => ... # string, one of ["0", "1", "2", "3"] (optional), default: "2"
workers => ... # number (optional), default: 1
}
}
The codec used for output data. Output codecs are a convenient method for encoding your data before it leaves the output, without needing a separate filter in your Logstash pipeline.
The full path to your Nagios command file.
Only handle events without any of these tags. Note this check is additional to type and tags.
The Nagios check level. Should be one of 0=OK, 1=WARNING, 2=CRITICAL, 3=UNKNOWN. Defaults to 2 - CRITICAL.
Only handle events with all of these tags. Note that if you specify a type, the event must also match that type. Optional.
The type to act on. If a type is given, then this output will only act on messages with the same type. See any input plugin’s “type” attribute for more. Optional.
The number of workers to use for this output. Note that this setting may not be useful for all outputs.