shinken-solutions / shinken

Flexible and scalable monitoring framework
http://www.shinken-monitoring.org
GNU Affero General Public License v3.0
1.13k stars 336 forks source link

inheritance of dependencies from templates #603

Open tvtue opened 12 years ago

tvtue commented 12 years ago

More info about this in the forum: http://www.shinken-monitoring.org/forum/index.php?topic=545

Seb-Solon : Copy here forum is moving

Hi,

I am trying to configure service dependencies for all nrpe checks of a host to the corresponding nrpe daemon on the same host. The problem is to write an elegant and short config for this.

Say I have 5 servers: server01, server02 ... server05. On each server the nrpe checks load, mem and disk.

I started creating servicedependency definitions for each nrpe check like so:

define service {
   use      my_service, nrpe
   hostgroup_name   my_servers
}

define service {
   use      my_service, load
   hostgroup_name   my-servers
}

define servicedependency {
   host_name            server01
   service_description   nrpe
   dependent_host_name   server01
   dependent_service_description   load
   notification_failure_criteria   c,u
   execution_failure_criteria   n
}

define servicedependency {
   host_name            server02
   service_description   nrpe
   dependent_host_name   server02
   dependent_service_description   load
   notification_failure_criteria   c,u
   execution_failure_criteria   n
}

define servicedependency {
   host_name            server03
   service_description   nrpe
   dependent_host_name   server03
   dependent_service_description   load
   notification_failure_criteria   c,u
   execution_failure_criteria   n
}
...

but that is lame and cumbersome.

Then I tried to use a servicegroup in the servicedependency definition:

define servicedependency {
   hostgroup_name           my_servers
   service_description   nrpe
   dependent_hostgroup_name   my_servers
   dependent_service_description   load, mem, disk
   notification_failure_criteria   c,u
   execution_failure_criteria   n
}

This "connects" every nrpe on any host with any load, mem and disk on any host. Kind a like an cartesian product. But that is wrong. What I need is a one on one dependency.

Then I asked in the monitoring portal for an elegant solution. Someone came up with the "same host depedency" trick, which I find to be very good. It can be achieved by leaving out the "dependent_host_name" or "dependent_hostgroup_name" line in the definition.

I tested this with only two hosts and one service on my Shinken 1.2 installation and with the following config:

define servicedependency {
   host_name            server01, server02
   service_description   nrpe
   #dependent_host_name   <empty> for same host dependency
   dependent_service_description   load
   notification_failure_criteria   w,c,u
   execution_failure_criteria   w,c,u
}

According to the "Impact Graph" Shinken still connects any nrpe services with any load service on every host.

Is this a bug in the core or in the Impact Graph rendering algorithm? How can I query servicedepencies? livestatus seems not to have a table "servicedependencies" or "servicedependencies".

TIA Timo

Seb-Solon commented 10 years ago

We should postpone it to 2.2 if it's not done.

naparuba commented 10 years ago

Too late for 2.0 sorry, will haveto wait 2.2

naparuba commented 9 years ago

wait again :)