Nagios config file syntax

295 Views Asked by At

I need to know the name of Nagios config files syntax, and how to parsing.

An example of Nagios host define.

define host {
    host_name                       bogus-router
    alias                           Bogus Router #1
    address                         192.168.1.254
    parents                         server-backbone
    check_command                   check-host-alive
    check_interval                  5
    retry_interval                  1
    max_check_attempts              5
    check_period                    24x7
    process_perf_data               0
    retain_nonstatus_information    0
    contact_groups                  router-admins
    notification_interval           30
    notification_period             24x7
    notification_options            d,u,r
}

Thanks.

1

There are 1 best solutions below

1
pzkpfw On

That's not an example of the Nagios configuration file. The Nagios configuration file (nagios.cfg) has an INI file syntax, i.e. name=value (but no sections).

The example you give is a Nagios object configuration file (referred to via cfg_file in the above config file), but I'm not sure what you're asking. The "name" of the syntax? I'm pretty sure it's not a standard syntax but simply "the" Nagios object syntax. In its simplest form, it's

define [object type] {
    attribute value
}

New lines separate attributes. The attribute never contains spaces, but the value may, depending on the attribute. Some attributes also take multiple values (like notification_options).