Page 1 of 2 12 LastLast
Results 1 to 10 of 16

Thread: Same Host Dependency - query servicedependenies

  1. #1

    Same Host Dependency - query servicedependenies

    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:

    Code:
    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:

    Code:
    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:

    Code:
    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

  2. #2
    Shinken project leader
    Join Date
    May 2011
    Location
    Bordeaux (France)
    Posts
    2,131

    Re: Same Host Dependency - query servicedependenies

    Why not use the "service_dependencies" of the service object? It should manage the "same host" if you put "" as an host name in this property.
    No direct support by personal message. Please open a thread so everyone can see the solution

  3. #3

    Re: Same Host Dependency - query servicedependenies

    Hello nap,

    thank you for your reply. I barely understand what you mean. Like so:

    Code:
    define service {
      service_description nrpe
      hostgroup_name  my_servers
      service_dependencies  ,load
    }
    ?




  4. #4

    Re: Same Host Dependency - query servicedependenies

    Ok, I've tested these two configs:

    Code:
    define service {
      use     my_service, nrpe
      host_name  server01
      service_dependencies  server01,load
    }
    Code:
    define service {
      use     my_service, nrpe
      host_name  server01
      service_dependencies  ,load
    }
    The latter one is not working as far as the Impact Graph shows it. As already said I don't know how to check whether service dependencies are correctly setup or not.

  5. #5
    Shinken project leader
    Join Date
    May 2011
    Location
    Bordeaux (France)
    Posts
    2,131

    Re: Same Host Dependency - query servicedependenies

    Depgraph is a good way, because LiveStatus do not export this data I think.

    So the first is ok, when the second is not? If so, I'll create a test case to check at this.
    No direct support by personal message. Please open a thread so everyone can see the solution

  6. #6

    Re: Same Host Dependency - query servicedependenies

    Yep, the first service definition seems to work, whereas the second one (with the hostname left out, only ",load&quot is broken.

    Attached some screenshots to show what I am seeing.

  7. #7

    Re: Same Host Dependency - query servicedependenies

    Here are two more screenshots that show the following service dependency definition in nagios 3.2.3 and in the Shinken UI Impact Graph. In the screenshot of the Impact Graph you can see, that "mailserv01/load" is connected with "mailserv06/nrpe". Which is wrong. The screenshot from nagios shows how it should be.

    Code:
    define servicedependency {
      host_name       mailserv01, mailserv06
      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
    }
    I hope this sheds some light on this.

  8. #8
    Shinken project leader
    Join Date
    May 2011
    Location
    Bordeaux (France)
    Posts
    2,131

    Re: Same Host Dependency - query servicedependenies

    I commit a fix for the property with "" hostname. Now it will work with one limitation : this "service_dependencies" cannot be inherit from a template (the dep creation pahse is before the inherit one, and change this will be too large and dangerous just before a bug fix release).

    https://github.com/naparuba/shinken/...9097494d1e7a48
    No direct support by personal message. Please open a thread so everyone can see the solution

  9. #9

    Re: Same Host Dependency - query servicedependenies

    Thank you for super fast fixing that!

    Now this works:
    Code:
    define service {
      use     my_service, nrpe
      host_name  server01
      service_dependencies  ,load
    }


    But, can you do the same for groups, too please?

    Code:
    define service {
      use     my_service, nrpe
      hostgroup_name  my_servers
      service_dependencies  ,load
    }

  10. #10

    Re: Same Host Dependency - query servicedependenies

    Hmm, I was just about to ask if specifiying multiple dependend services should work, because it didn't. But the problem was only the space character(s) between the commas.

    Code:
    define service {
      use     my_service, nrpe
      #hostgroup_name  my_servers
      host_name  server01
      #service_dependencies  ,load, ,mem  <-- doesn't work
      service_dependencies  ,load,,mem <-- works
    }
    I find this to be worth a fix, too. Am I bold today?

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •