Implied object inheritance and the web interface
Posted: Wed Aug 19, 2020 8:15 am
Hello, I need some help with the contacts/contact_groups implied object inheritance and the web interface.
I'm running Nagios Core 4.4.3.
I have many hosts and their related services, every host has a contact_groups property declared (and not contacts one), almost every related service doesn't have its of contacts/contact_groups because I'm ok with inheriting them from the host.
There are though some specific services that define their own contacts and contact_groups because I need a different behaviour.
Specifically I need that these service are notified and displayed on the web interface to different users than all the other host's services.
The problem I'm facing is that, while the notification part works properly, on the web interface I get mixed results.
Using the example snippet i posted below this is what I'm getting:
- Contact "all_notifications" gets notifications for all services "check 1", "check 2" and "check 3" and also sees them on the web interface as expected.
- Contact "check3_notifications" gets notifications for service "check 3" and sees only "check3" on the web interface as expected.
- Contact "web_user" gets notifications for services "check 1" and "check 2" but sees all of them on the web interface and that's where I'm failing to understand what's going on.
Am I doing something wrong? Is this the expected behaviour? Shouldn't "web_user" see the same services it gets notifications for?
I'm pointing at the implied object inheritance because it seems to me that the web interface do not take properly account of the contacts/contact_groups override on the service object and instead does an implicit additive inheritance with the ones from the host and the ones from the service (implicit means I didn't put any "+" sign anywhere).
The main and only reason for this, in case you're wondering, is that those specific services, like "check 3" here, are intended for other people than all other services (e.g.: "check 1" and "check 2") and those who see others don't want to have their web interface "cluttered" with unwanted services.
This is of course a semplified configuration snippet, I think (hope) I kept all the relevant parts.
I'm running Nagios Core 4.4.3.
I have many hosts and their related services, every host has a contact_groups property declared (and not contacts one), almost every related service doesn't have its of contacts/contact_groups because I'm ok with inheriting them from the host.
There are though some specific services that define their own contacts and contact_groups because I need a different behaviour.
Specifically I need that these service are notified and displayed on the web interface to different users than all the other host's services.
The problem I'm facing is that, while the notification part works properly, on the web interface I get mixed results.
Using the example snippet i posted below this is what I'm getting:
- Contact "all_notifications" gets notifications for all services "check 1", "check 2" and "check 3" and also sees them on the web interface as expected.
- Contact "check3_notifications" gets notifications for service "check 3" and sees only "check3" on the web interface as expected.
- Contact "web_user" gets notifications for services "check 1" and "check 2" but sees all of them on the web interface and that's where I'm failing to understand what's going on.
Am I doing something wrong? Is this the expected behaviour? Shouldn't "web_user" see the same services it gets notifications for?
I'm pointing at the implied object inheritance because it seems to me that the web interface do not take properly account of the contacts/contact_groups override on the service object and instead does an implicit additive inheritance with the ones from the host and the ones from the service (implicit means I didn't put any "+" sign anywhere).
The main and only reason for this, in case you're wondering, is that those specific services, like "check 3" here, are intended for other people than all other services (e.g.: "check 1" and "check 2") and those who see others don't want to have their web interface "cluttered" with unwanted services.
This is of course a semplified configuration snippet, I think (hope) I kept all the relevant parts.
Code: Select all
define host {
host_name host1
address host1.mydomain.loc
contact_groups cg-host-monitoring
...
}
define service {
host_name host1
service_description check 1
...
}
define service {
host_name host1
service_description check 2
...
}
define service {
host_name host1
service_description check 3
contacts check3_notifications
contact_groups cg-check3
...
}
define contactgroup {
contactgroup_name cg-host-monitoring
members all_notifications,web_user
}
define contactgroup {
contactgroup_name cg-check3
members all_notifications
}
define contact {
contact_name all_notifications
...
}
define contact {
contact_name web_user
...
}
define contact {
contact_name check3_notifications
...
}