Page 1 of 1

Nagios Syntax

Posted: Mon Dec 19, 2016 6:26 am
by amprantino
Hello all,

Code: Select all

define service{
        use                             generic-service
        host_name                       host1,host2
        service_description             ServiceName
        is_volatile                     0
        check_period                    24x7
        max_check_attempts              2
       normal_check_interval           10080
        retry_check_interval            2
        contact_groups                  admins
        notification_interval           1440
        notification_period             24x7
        notification_options            c,w,r
        check_command                   check_command!snmp
}
Are there any abbreviation for 1440 or 10080 ? For example 1w (1440) or 7d (10080)?

2) When I verify the config:

Warning: Service 'ServiceName' on host 'host1' has a notification interval less than its check interval! Notifications are only re-sent after checks are made, so the effective interval will be that of the check interval.
On the above example, I would like the check to be executed every one week. If an error is detected then the notification should be send every 1440 minutes *=1 day)
Is the above behavior achieved with this configuration?

Is it possible to disable this warning when verifying the config ?

3)
"," at the end of lines is not handled as error. For example:

Code: Select all

define service{
        use                             generic-service
        host_name                       host1,host2,
Is this the expected behavior?

Thank you

Re: Nagios Syntax

Posted: Mon Dec 19, 2016 11:30 am
by rkennedy
1. No, you'll want to use minutes. This time is relative to the 60 set in your nagios.cfg.

2. You could set a retry_interval to help counter this, otherwise what it is stating is spot on. No, it's not possible to disable the warning.

3. This is expected, commas are used as delimiters.

Re: Nagios Syntax

Posted: Fri Dec 23, 2016 4:15 am
by amprantino

Code: Select all

define host {
        host_name                       GROUP1

}
define hostgroup{
        hostgroup_name  GROUP1
        members         host1,host2,host3,GROUP1
}

define hostgroup{
        hostgroup_name  NEW_GROUP
        members         host6,host7
        hostgroup_members       GROUP1
}
NEW_GROUP members aren't updated when I have added host "GROUP1" to hostgroup GROUP1
( hostgroup and host name are the same)

Re: Nagios Syntax

Posted: Tue Dec 27, 2016 12:47 pm
by rkennedy
Are you applying configuration? I don't think your GROUP1 host will register as a host properly with no template or anything else assigned - does it have a template assigned that you are not showing us?

I just verified all functionality is working with this as you'd expect -

Code: Select all

define hostgroup {
        hostgroup_name                          inheritedhg
        alias                                   this hostgroup is inherited.
        members                                 192.168.1.1,192.168.4.11,192.168.4.15
        }

define hostgroup {
        hostgroup_name                          topgroup
        alias                                   this hostgroup is the top
        members                                 localhost,veeam.nagios.local
        hostgroup_members                       inheritedhg
        }
Anything I add to inheritedhg gets picked up by topgroup.