Results 1 to 8 of 8

Thread: [RESOLVED] How to set service_dependencies from packs

  1. #1
    Member
    Join Date
    Jun 2012
    Location
    France
    Posts
    52

    [RESOLVED] How to set service_dependencies from packs

    Hi all,

    according to http://www.shinken-monitoring.org/fo...0.html#msg3000, it's not possible to set some service dependencies from a template.

    Is it the same for packs?

    example with a service from a personnal pack:
    Code:
    define service{
      service_description  $KEY$-grantdba
      use          qualification,generic-service
      register        0
      host_name       bronze
      check_command     check_oracle_grantdba!$KEY$
      duplicate_foreach   _databases
      notes_url      http://@IP/wiki/index.php/check_oracle_grantdba.pl
      service_dependencies ,$KEY$-isdbup
    }
    I would like the service depend of $KEY$-isdbup on the same server.

    Thank you in advance for any ideas

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

    Re: How to set service_dependencies from packs

    Yes from now it's not possible, not because of the pack/template, but because of the $KEY$ that is not expanded for this property.

    If you find the line :
    new_s.aggregation = new_s.aggregation.replace('$' + key + '$', key_value[key])

    On the file :
    https://github.com/naparuba/shinken/...cts/service.py

    And apply it on your service.py file, you should find a way to do the same thing for the service_dep property and give a try.
    No direct support by personal message. Please open a thread so everyone can see the solution

  3. #3
    Member
    Join Date
    Jun 2012
    Location
    France
    Posts
    52

    Re: How to set service_dependencies from packs

    Nice, i'll try that

    thank you

  4. #4
    Member
    Join Date
    Jun 2012
    Location
    France
    Posts
    52

    Re: How to set service_dependencies from packs

    It Nap,

    after few tries it works by moving (property def) from running_properties to properties
    Code:
        # Easy Service dep definition
        'service_dependencies': ListProp(default=''), # TODO: find a way to brok it?
    then by adding the following after "new_s.check_command = new_s.check_command.replace('$' + key + '$', key_value[key])"
    Code:
                if hasattr(self, 'service_dependencies'):
                  new_s.service_dependencies = new_s.service_dependencies.replace('$' + key + '$', key_value[key])
    Thank you

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

    Re: How to set service_dependencies from packs

    Hum good catch for the propery/running property. In fact it's far better to be in property than the running one.

    In property, it's all that is in the configuration and should be read in configuration. Running are only elements create "on the run" to manage the status and things like that. And here the depedencies is indeed a real configuration parameter, not just a running one, so the good place is the property dict

    I'll create a test case with your sample and commit your patch. Thanks a lot for this idea
    No direct support by personal message. Please open a thread so everyone can see the solution

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

    Re: How to set service_dependencies from packs

    It's commited, will be available for all in the 1.4 version
    No direct support by personal message. Please open a thread so everyone can see the solution

  7. #7
    Member
    Join Date
    Jun 2012
    Location
    France
    Posts
    52

    Re: How to set service_dependencies from packs

    [quote author=naparuba link=topic=827.msg4596#msg4596 date=1363869374]
    Hum good catch for the propery/running property. In fact it's far better to be in property than the running one.
    [/quote]

    I fact i begin my tries with the property in place, won't work. After a brief code read moving it appears to be the right thing to do.

    [quote author=naparuba link=topic=827.msg4596#msg4596 date=1363869374]
    I'll create a test case with your sample and commit your patch. Thanks a lot for this idea
    [/quote]

    You're welcome, it'll be usefull in many cases.

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

    Re: [RESOLVED] How to set service_dependencies from packs

    Yes indeed, like dep between the N Oracle service and the Oracle connexion one, for each database!
    No direct support by personal message. Please open a thread so everyone can see the solution

Posting Permissions

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