Check "ping4" assigned to ALL host, automaticaly

Hi all!
I noticed that all my host (defined with director) have the check “ping4” assigned by default.
This command is not included into any HostTemplate or service template.
I do not recognize how is assigned by default to all my hosts.
I need to chenge this command because not all my host reply correctly to ping, and so I need to customize this check.

I have observed that this check comes from the servicegroup named “ping” that do not exist into director.
If I try to create a servicegroup with same name (“ping”) the deploy goes in error:

critical/config: Error: Object ‘ping’ of type ‘ServiceGroup’ re-defined: in [stage]/zones.d/director-global/servicegroups.conf: 1:0-1:25; previous definition: in /etc/icinga2/conf.d/groups.conf: 21:1-21:26 Location: in [stage]/zones.d/director-global/servicegroups.conf: 1:0-1:25 [stage]/zones.d/director-global/servicegroups.conf(1): object ServiceGroup “ping” { ^^^^^^^^^^^^^^^^^^^^^^^^^^

How is possible?
How can I edit this servicegroup and the checks it contains ?
Regards
P.

Hi,

the ping4 check comes from the default configuration that is located in the conf.d directory. You can and should disable the inclusion of the conf.d directory, since it is best practice to only have one configuration source, in your case this should be the Director.

Verify that the conf.d directory inclusion is disabled, but ensure that you keep the api-users.conf inclusion, since this is required to run Director.

# vim /etc/icinga2/icinga2.conf

// Commented out, not required when using Director 
// include_recursive "conf.d"

include "conf.d/api-users.conf"

If you disabled the inclusion the default check ping4 should be gone and you can create your own using Director.

Best regards
Michael

1 Like

In this way I loose the complete configuration for localhost (ICINGA Master node) ?
How can I save this config and import into director ?

I try your suggestion but after
// Commented out, not required when using Director
// include_recursive “conf.d”

include “conf.d/api-users.conf”

If I run "icinga2 demon -C

I have a lot of errors

You lose the default configuration (i.e. default ping check) and maybe your own checks if you added them here. You should create the services for the master node inside the Director as well.

Can you please share them here?

1 Like

THis is only a part ot the errors I have.
Are all related to notification template

[2020-03-09 19:18:23 +0100] information/cli: Icinga application loader (version: r2.11.3-1)
[2020-03-09 19:18:23 +0100] information/cli: Loading configuration file(s).
[2020-03-09 19:18:23 +0100] information/ConfigItem: Committing config item(s).
[2020-03-09 19:18:23 +0100] information/ApiListener: My API identity: icinga2-dev.bgp.locale
[2020-03-09 19:18:24 +0100] critical/config: Error: Validation failed for object ‘GIESSE_ECC_GSG!Notification Host’ of type ‘Notification’; Attribute ‘command’: Object ‘mail-host-notification’ of type ‘NotificationCommand’ does not exist.
Location: in /var/lib/icinga2/api/packages/director/302dfc41-82b4-4df1-a982-c614d88bcdb9/zones.d/icinga2-dev.bgp.locale/notification_templates.conf: 2:5-2:38
/var/lib/icinga2/api/packages/director/302dfc41-82b4-4df1-a982-c614d88bcdb9/zones.d/icinga2-dev.bgp.locale/notification_templates.conf(1): template Notification “BGP Host Notification by Mail” {
/var/lib/icinga2/api/packages/director/302dfc41-82b4-4df1-a982-c614d88bcdb9/zones.d/icinga2-dev.bgp.locale/notification_templates.conf(2): command = “mail-host-notification”
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
/var/lib/icinga2/api/packages/director/302dfc41-82b4-4df1-a982-c614d88bcdb9/zones.d/icinga2-dev.bgp.locale/notification_templates.conf(3): interval = 5m
/var/lib/icinga2/api/packages/director/302dfc41-82b4-4df1-a982-c614d88bcdb9/zones.d/icinga2-dev.bgp.locale/notification_templates.conf(4): period = “BGP_RemoteWorkHours_08-20”

[2020-03-09 19:18:24 +0100] critical/config: Error: Validation failed for object ‘TODS_ECC_RT1!Notification Host’ of type ‘Notification’; Attribute ‘command’: Object ‘mail-host-notification’ of type ‘NotificationCommand’ does not exist.
Location: in /var/lib/icinga2/api/packages/director/302dfc41-82b4-4df1-a982-c614d88bcdb9/zones.d/icinga2-dev.bgp.locale/notification_templates.conf: 2:5-2:38
/var/lib/icinga2/api/packages/director/302dfc41-82b4-4df1-a982-c614d88bcdb9/zones.d/icinga2-dev.bgp.locale/notification_templates.conf(1): template Notification “BGP Host Notification by Mail” {
/var/lib/icinga2/api/packages/director/302dfc41-82b4-4df1-a982-c614d88bcdb9/zones.d/icinga2-dev.bgp.locale/notification_templates.conf(2): command = “mail-host-notification”
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
/var/lib/icinga2/api/packages/director/302dfc41-82b4-4df1-a982-c614d88bcdb9/zones.d/icinga2-dev.bgp.locale/notification_templates.conf(3): interval = 5m
/var/lib/icinga2/api/packages/director/302dfc41-82b4-4df1-a982-c614d88bcdb9/zones.d/icinga2-dev.bgp.locale/notification_templates.conf(4): period = “BGP_RemoteWorkHours_08-20”

[2020-03-09 19:18:24 +0100] critical/config: Error: Validation failed for object ‘RECORDATI_ECC_RT1!Notification Host’ of type ‘Notification’; Attribute ‘command’: Object ‘mail-host-notification’ of type ‘NotificationCommand’ does not exist.
Location: in /var/lib/icinga2/api/packages/director/302dfc41-82b4-4df1-a982-c614d88bcdb9/zones.d/icinga2-dev.bgp.locale/notification_templates.conf: 2:5-2:38
/var/lib/icinga2/api/packages/director/302dfc41-82b4-4df1-a982-c614d88bcdb9/zones.d/icinga2-dev.bgp.locale/notification_templates.conf(1): template Notification “BGP Host Notification by Mail” {
/var/lib/icinga2/api/packages/director/302dfc41-82b4-4df1-a982-c614d88bcdb9/zones.d/icinga2-dev.bgp.locale/notification_templates.conf(2): command = “mail-host-notification”
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
/var/lib/icinga2/api/packages/director/302dfc41-82b4-4df1-a982-c614d88bcdb9/zones.d/icinga2-dev.bgp.locale/notification_templates.conf(3): interval = 5m
/var/lib/icinga2/api/packages/director/302dfc41-82b4-4df1-a982-c614d88bcdb9/zones.d/icinga2-dev.bgp.locale/notification_templates.conf(4): period = “BGP_RemoteWorkHours_08-20”

[2020-03-09 19:18:24 +0100] critical/config: Error: Validation failed for object ‘FENDI_S4_STT!Notification Host’ of type ‘Notification’; Attribute ‘command’: Object ‘mail-host-notification’ of type ‘NotificationCommand’ does not exist.
Location: in /var/lib/icinga2/api/packages/director/302dfc41-82b4-4df1-a982-c614d88bcdb9/zones.d/icinga2-dev.bgp.locale/notification_templates.conf: 2:5-2:38
/var/lib/icinga2/api/packages/director/302dfc41-82b4-4df1-a982-c614d88bcdb9/zones.d/icinga2-dev.bgp.locale/notification_templates.conf(1): template Notification “BGP Host Notification by Mail” {
/var/lib/icinga2/api/packages/director/302dfc41-82b4-4df1-a982-c614d88bcdb9/zones.d/icinga2-dev.bgp.locale/notification_templates.conf(2): command = “mail-host-notification”
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
/var/lib/icinga2/api/packages/director/302dfc41-82b4-4df1-a982-c614d88bcdb9/zones.d/icinga2-dev.bgp.locale/notification_templates.conf(3): interval = 5m
/var/lib/icinga2/api/packages/director/302dfc41-82b4-4df1-a982-c614d88bcdb9/zones.d/icinga2-dev.bgp.locale/notification_templates.conf(4): period = “BGP_RemoteWorkHours_08-20”

[2020-03-09 19:18:24 +0100] critical/config: Error: Validation failed for object ‘SKYTV_ECC_P01!Notification Host’ of type ‘Notification’; Attribute ‘command’: Object ‘mail-host-notification’ of type ‘NotificationCommand’ does not exist.
Location: in /var/lib/icinga2/api/packages/director/302dfc41-82b4-4df1-a982-c614d88bcdb9/zones.d/icinga2-dev.bgp.locale/notification_templates.conf: 2:5-2:38
/var/lib/icinga2/api/packages/director/302dfc41-82b4-4df1-a982-c614d88bcdb9/zones.d/icinga2-dev.bgp.locale/notification_templates.conf(1): template Notification “BGP Host Notification by Mail” {
/var/lib/icinga2/api/packages/director/302dfc41-82b4-4df1-a982-c614d88bcdb9/zones.d/icinga2-dev.bgp.locale/notification_templates.conf(2): command = “mail-host-notification”
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
/var/lib/icinga2/api/packages/director/302dfc41-82b4-4df1-a982-c614d88bcdb9/zones.d/icinga2-dev.bgp.locale/notification_templates.conf(3): interval = 5m
/var/lib/icinga2/api/packages/director/302dfc41-82b4-4df1-a982-c614d88bcdb9/zones.d/icinga2-dev.bgp.locale/notification_templates.conf(4): period = “BGP_RemoteWorkHours_08-20”

[2020-03-09 19:18:24 +0100] critical/config: Error: Validation failed for object ‘BULGARI_HR_HR3!Notification Host’ of type ‘Notification’; Attribute ‘command’: Object ‘mail-host-notification’ of type ‘NotificationCommand’ does not exist.
Location: in /var/lib/icinga2/api/packages/director/302dfc41-82b4-4df1-a982-c614d88bcdb9/zones.d/icinga2-dev.bgp.locale/notification_templates.conf: 2:5-2:38
/var/lib/icinga2/api/packages/director/302dfc41-82b4-4df1-a982-c614d88bcdb9/zones.d/icinga2-dev.bgp.locale/notification_templates.conf(1): template Notification “BGP Host Notification by Mail” {
/var/lib/icinga2/api/packages/director/302dfc41-82b4-4df1-a982-c614d88bcdb9/zones.d/icinga2-dev.bgp.locale/notification_templates.conf(2): command = “mail-host-notification”
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
/var/lib/icinga2/api/packages/director/302dfc41-82b4-4df1-a982-c614d88bcdb9/zones.d/icinga2-dev.bgp.locale/notification_templates.conf(3): interval = 5m
/var/lib/icinga2/api/packages/director/302dfc41-82b4-4df1-a982-c614d88bcdb9/zones.d/icinga2-dev.bgp.locale/notification_templates.conf(4): period = “BGP_RemoteWorkHours_08-20”

The main problem is that you mixed two different configuration methods, plain configuration files and Director. I suggest to use only one method, either plain configuration files or Director.

The validation now fails because you used the NotificationCommand mail-host-notification from the default configuration inside your Director configuration. You have to re-create the NotificationObject in the Director.

1 Like

OK. Thanks!
I recreated the 2 Commands and NOW the deploy works fine.
Unfortunately this way I lost the MASTER node and all the related service checks.
Is there a Way to recover the Icinga2 master node configuration\configuration checks ?

Yes, as @mcktr said, just add the master host to Director like you would any other host. With all the apply rules in place it should have the same checks as before.

There’s no (easy) way of importing it. Just add it like any other host. You can use it’s “real” address or go for 127.0.0.1 as long as you don’t have redundant masters.

1 Like