Your notification "mail-icingaadmin" only checks for vars.notification.mail in the corresponding host object of the service, i.e. you have to define the recipients of service notification in the host object to which the service belongs to.

It doesn't set any specific period or interval, thus it's taken from the template or it uses the default setting.

If you add

  interval = service.vars.notification_interval

it would set the interval to the value given in the service object variable. You should test if it works as expected, in particular with those services which don't define the value. Or you could set the value only if it's set in the service object:

  if ( service.vars.notification_interval ) {
    interval = service.vars.notification_interval
  }

I am not sure, but I think you have to do this in the "apply Notification" statement not in the template. The template doesn't know about the service. It's the apply statement which creates the link between the service and the notification...

-Gerald


On 14.06.16 09:18, Jakub Šídlo wrote:
apply Notification "mail-icingaadmin" to Service {
  import "mail-service-notification"

  user_groups = host.vars.notification.mail.groups
  users = host.vars.notification.mail.users

  assign where host.vars.notification.mail
}

Mail-service-notification is being pointed from templates.conf which reads
template Notification "mail-service-notification" {
  command = "mail-service-notification"

  states = [ OK, Warning, Critical, Unknown ]
  types = [ Problem, Acknowledgement, Recovery, Custom,
            FlappingStart, FlappingEnd,
            DowntimeStart, DowntimeEnd, DowntimeRemoved ]

  period = "24x7"
}

Just had this marvelous idea:
Correct me if I'm wrong ok? (I'm still learning)
If I define in object service vars.notification_interval without being considered in 
mail-service-notificatoin. It won't work right? Like if i edited the template Notification 
"mail-service-notification" with adding interval = 
"service.vars.notification_interval" would that work?
JS

P.S.: I know where all the config files are.

-----Original Message-----
From: icinga-users [mailto:[email protected]] On Behalf Of 
Gerald Vogt
Sent: Tuesday, June 14, 2016 8:49 AM
To: [email protected]
Subject: Re: [icinga-users] Notifications?

Posting templates for Host, Service or Dependencies won't help either.

You really have to post the Notification objects definitions. "icinga2 object 
list" only shows you the parsed results. You should really read the manual pages 
before using tools. That would be better then simplying trying various things.

You should know where your configuration files are. That's fundamental basics.

Run

   icinga2 object list -t Notification -n '*!updates!*'

and look and learn where you configuration files are. Then post the definition 
of the Notification object...

-Gerald

On 14.06.16 08:40, Jakub Šídlo wrote:
By looking for those imports the closest thing I've found was template
Host "satellite-host" {
  vars.notification["mail"] = {
    groups = [ "icingaadmins" ]
  }
}
template Service "satellite-service" {
  vars.notification["mail"] = {
    groups = [ "icingaadmins" ]
  }
}


apply Dependency "satellite-host" to Host {
  parent_host_name = host.zone

  assign where host.zone != "" && "satellite-host" in host.templates }

When I've listed all object
Icinga2 object list | grep "object notification"
Icinga2 object list | grep "apply notification"
Nothing was found
JS

-----Original Message-----
From: icinga-users [mailto:[email protected]] On
Behalf Of Gerald Vogt
Sent: Tuesday, June 14, 2016 8:25 AM
To: [email protected]
Subject: Re: [icinga-users] Notifications?

Now you have posted the definitions of your Host, Zone and Endpoint objects. 
You still haven't posted the definition of your Notification object. The 
notification object defines the interval, periods, etc. for notifications. The 
notification object has to evaluate those variables which you have set in your 
service object...

Please post the definition of your notification object.

A notification object is defined by

object Notification ...

or more likely by

apply Notification ...

-Gerald



On 14.06.16 08:21, Jakub Šídlo wrote:
Host is defined as this:
 object Host "testing" {
        import "satellite-host"
        check_command = "cluster-zone"
}
Zone:
object Zone "testing" {
        endpoints = [ "testing" ]
}
Endpoint
object Endpoint "testing" {
}

It was imported via icinga2 node update-config

-----Original Message-----
From: icinga-users [mailto:[email protected]] On
Behalf Of Gerald Vogt
Sent: Tuesday, June 14, 2016 8:05 AM
To: [email protected]
Subject: Re: [icinga-users] Notifications?

You have posted the service object. What is the definition of the notification 
object? Does that evaluate those variables at all?

-Gerald

On 14.06.16 08:03, Jakub Šídlo wrote:
Hi there,



I’ve bit of a problem with Icinga2 clients (both Windows and Linux
node)

I’ve connected few windows servers to our Icinga2 via Icinga client
for windows (and Linux node install)

but check_updates keeps being critical with updates being ready for
installation (cannot install them when they come out since those’re
production servers)

I tried to configure the update like this:



object Service "updates" {

                import "satellite-service"

                check_command = "dummy"

                host_name = "testing"

                zone = "testing"

                vars.notification_interval = 24h

                vars.notification_period = "24x7"

}



But the notifications are still being sent at roughly 15 minute
intervals (even when I changed notification_interval to 0 nothing
happened)



JS



_______________________________________________
icinga-users mailing list
[email protected]
https://lists.icinga.org/mailman/listinfo/icinga-users

_______________________________________________
icinga-users mailing list
[email protected]
https://lists.icinga.org/mailman/listinfo/icinga-users
_______________________________________________
icinga-users mailing list
[email protected]
https://lists.icinga.org/mailman/listinfo/icinga-users

_______________________________________________
icinga-users mailing list
[email protected]
https://lists.icinga.org/mailman/listinfo/icinga-users
_______________________________________________
icinga-users mailing list
[email protected]
https://lists.icinga.org/mailman/listinfo/icinga-users

_______________________________________________
icinga-users mailing list
[email protected]
https://lists.icinga.org/mailman/listinfo/icinga-users
_______________________________________________
icinga-users mailing list
[email protected]
https://lists.icinga.org/mailman/listinfo/icinga-users

_______________________________________________
icinga-users mailing list
[email protected]
https://lists.icinga.org/mailman/listinfo/icinga-users

Reply via email to