How to add contact & contactgroup to host (with director)?

Hello,

How to add contact to host?
I need this:

but I don´t know, how… can you help me please?
I have created contact, and contact group, but I don´t know, how to add contact to host.
I have this:

Any ideas how to add contact (or contactgroup) to host?
I´m using Director btw.

Thanks,
Kevin

Hi Kevin,
You have to create a notification or modify an existing one in the Icinga director. After deploying the config, there should be an entry in the “Benachrichtungen” section of the host/service.

For example (running on my Vagrant Icinga standalone box):
image

Sample config
apply Notification "test-notification-1" to Host {
    import "my-notification-template"

    assign where match("*", host.name)
}
template Notification "my-notification-template" {
    command = "mail-host-notification"
    users = [ "kevin" ]
}

Kind regards,
Bernd

1 Like

Hello, thanks for answer.

Add it to hosts.conf? Or where?

Do you have a notifications.conf file? Depending on your setup, there might be a conf.d directory. Mine is /etc/icinga2/conf.d/, so any .conf file residing in this directory is included in the configuration (include_recursive "conf.d" in the icinga2.conf file).

Notifications should stay in a file named notifications.conf, so you’ll find the definitions very easy in the future.

And this is wrong?

Is this correct?

image

image

(after I was change it, i redeploy config in director, but it doesn´t work)

Or I don´t uderstand it… :frowning:

Hello, please help me… I´m idiot on this :confused:

Here´s my contact in icinga2.

I was edited the file in /etc/icinga2/conf.d/notifications.conf:
image

And after redeploy in icinga2 director I still can´t see contact group, or user. :frowning:

Please help me…
Thanks

Hi, all right, you’re using the Icinga director. Sorry, I’ve missed that part.

Please undo your changes in the conf files. Since you’re using the director, the notifications have to be defined in the director too. You’ll find the notification and notification templates in the director menu.

Could you try that please?

That will be problem… because I don´t have backup of these files, and I edited and closed it yesterday, so I can´t take my actions back. :confused:

My notifications.conf looks:

users.conf
image

commands.conf

Is everything alright?

Thanks

I configured as you can see on the picture.

The problem is, that I don´t know what to add to this:
image

Do you know?

I don´t know, what I´m doing bad… :frowning:

The error message is truncated in your screenshot.

But in the previous screenshot you’ve added Critical, … in the notification for a host object. Host objects can only be in the states Up and Down. So you have to specify Up and Down only. After changing this, try to deploy the config again.

How I have it now.

notifications.conf

Director/Notifications/

Director/Notifications/Templates

Maybe…
Could be this problem?

I really don´t know, where could be a problem… :frowning:
This is last point, what I need. Please help me.

Hi,
ideally you would create a service template having “Send notification = yes”, and reference that in your apt service in the Imports field.

Sorry for the late response, I was a while off…

With all due repsect, have you thought about attending a course about Icinga and the Icinga Director? I think that would be great to settle the fundamentals.

Kind regards,
Bernd