Page 1 of 1

Nagios config file syntax

Posted: Tue Apr 26, 2022 2:07 am
by SandraLewisFrin
Hi

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 omegle shagle voojio_options d,u,r
}
Thanks.

Re: Nagios config file syntax

Posted: Fri Apr 29, 2022 4:33 am
by PaulRajeshMEzra45
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).