0

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.

  • Hello and welcome here at StackOverflow. I am not sure what is your problem, but try check out official documentation - https://assets.nagios.com/downloads/nagioscore/docs/nagioscore/3/en/objectdefinitions.html#host – Rohlik Jan 13 '21 at 11:54
  • Thanks for your reply. – Eyad Abu Arqoub Jan 14 '21 at 21:14

1 Answers1

1

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).

pzkpfw
  • 565
  • 3
  • 21
  • Thanks for your reply, I think as you mentioned its just Nagios object syntax. I just going to write a script to parse Nagios objects and doing some daily tasks on Nagios, that's why I asked about the syntax. – Eyad Abu Arqoub Jan 14 '21 at 21:14