nagios

Milestone: 2

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 } } }

Synopsis

This is what it might look like in your config file:
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
  }
}

Details

codec

  • Value type is codec
  • Default value is "plain"

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.

commandfile

  • Value type is path
  • Default value is "/var/lib/nagios3/rw/nagios.cmd"

The full path to your Nagios command file.

exclude_tags DEPRECATED

  • DEPRECATED WARNING: This config item is deprecated. It may be removed in a further version.
  • Value type is array
  • Default value is []

Only handle events without any of these tags. Note this check is additional to type and tags.

nagios_level

  • Value can be any of: "0", "1", "2", "3"
  • Default value is "2"

The Nagios check level. Should be one of 0=OK, 1=WARNING, 2=CRITICAL, 3=UNKNOWN. Defaults to 2 - CRITICAL.

tags DEPRECATED

  • DEPRECATED WARNING: This config item is deprecated. It may be removed in a further version.
  • Value type is array
  • Default value is []

Only handle events with all of these tags. Note that if you specify a type, the event must also match that type. Optional.

type DEPRECATED

  • DEPRECATED WARNING: This config item is deprecated. It may be removed in a further version.
  • Value type is string
  • Default value is ""

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.

workers

  • Value type is number
  • Default value is 1

The number of workers to use for this output. Note that this setting may not be useful for all outputs.


This is documentation from lib/logstash/outputs/nagios.rb