Notifacations

Hello I have notifications setup and I am getting a notification about every 5 mins when something is down.

Is it possible to get it to send one per day and send only when in warning or critical status for longer then a set time

Hello I have notifications setup and I am getting a notification about
every 5 mins when something is down.

That suggests you need to look at the “interval” setting in your Notification
definition.

Is it possible to get it to send one per day and send only when in warning
or critical status for longer then a set time

Do you mean “send one per day at a fixed time, if there has been a warning or
critical status in the past 24 hours”, or “send a notification when a warning
or critical status occurs, but don’t send another notification for a further 24
hours”?

If it’s the former, you might be able to manage that with TimePeriods.

If it’s the latter, just set your “interval” in the Notification definition to
24h.

As for “only when in warning or ciritical status for longer than a set time”,
that’s determined by the check_interval and max_check_attempts settings for
your services.

Regards,

Antony.

there is also the times.begin variable which delays a notification for a set time, which is probably meant here.
Example: times.begin=5m (or in seconds)
Normally the notification goes out directly after a hard state is reached, with times.begin icinga waits for the specified time. If the state didn’t change during that time, the notification is triggered.

1 Like

ok so I have put the interval in the notifacation.conf and that didnt work when I tried to put in in for the services that gives me an error when trying to restart the icinga2 service

Please post the content of your notification.cnof

1 Like

Here is the notification.conf

/**
 * The example notification apply rules.
 *
 * Only applied if host/service objects have
 * the custom attribute `notification` defined
 * and containing `mail` as key.
 *
 * Check `hosts.conf` for an example.
 */

apply Notification "mail-icingaadmin" to Host {
  import "mail-host-notification"
  user_groups = [ "Techs" ]
  users = host.vars.notification.mail.users

  interval = 24h

  //vars.notification_logtosyslog = true

  assign where (host.address || host.address6)
}

apply Notification "mail-icingaadmin" to Service {
  import "mail-service-notification"
  user_groups = [ "Techs" ]
  users = host.vars.notification.mail.users

  interval = 24h

  //vars.notification_logtosyslog = true

  assign where (host.address || host.address6)
}

Is this how the notification file should look or am I missing something

This way you get notifications every 24h as long as the problem persists.
If you want to be notified only once set the interval to 0

And, as @rsturm has said, if you want the notifications to begin after some time has passed you use times.begin
This you can combine with interval to send notification only once or periodically after some delay.