Results 1 to 9 of 9

Thread: What is the fundamental difference between hosts and services definition in Shinken ?

  1. #1
    Junior Member
    Join Date
    Aug 2014
    Location
    Paris, France
    Posts
    21

    What is the fundamental difference between hosts and services definition in Shinken ?

    Hi,

    I'm trying to have higher check rates for some servers. These servers use some standard packs (linux-ssh, http...)
    So I just need to keep change the normal checks for a subset of hosts:
    normal checks:
    check_interval 15
    max_check_attempts 5
    retry_interval 3

    What I want:
    check_interval 10
    max_check_attempts 3
    retry_interval 1


    ------------------1st try
    To do this configuration in 1 place, I wanted first to create a new service with new name:
    define service{
    name linux-ssh-priority
    use generic-service-priority,linux-ssh
    register 0
    }
    Simple and elegant, I was hoping it would work
    No luck, it is not working: it can't be loaded directly in my website.cfg file, or I have this error
    [Shinken] [items] Service u'linux-ssh-priority' use/inherit from an unknown template (u'linux-ssh') ! Imported from: /etc/shinken/templates/generic-service-priority.cfg:14

    so Shinken starts, but silently, I have no linux-ssh check for my host...

    ------------------ 2nd try
    After a quick look at the linux-ssh pack, I change my service definition to add an eextra 'host' layer, as this:
    define host{
    name linux-ssh-priority
    use generic-host-priority
    register 0
    }

    define service{
    host_name linux-ssh-priority ; remark you have to change the keyword from name to host_name here, in service... why?
    use generic-service-priority,linux-ssh
    register 0
    }

    but it's worse, I have this error: [Shinken] The service linux-ssh-priority on host 'www-website' does not have check_command
    Shinken doesn't start at all.

    ------------------3rd try
    no 3rd try, I broke all, I just don't get the way it works.

    What am I doing wrong ?
    Why is it working in the pack, and not in my example (basically same as pack, with some value overwritten) ?

    Thanks for helping me see clear in services/hosts config
    ATI

  2. #2
    Junior Member
    Join Date
    Aug 2014
    Location
    Paris, France
    Posts
    21
    Hi all,

    again, same question with another example: I have a host that has a database, and I want all notifications to be sent to DBA team alongside IT team.
    I did this:
    define host {
    host_name DATABASESERVER1
    use generic-host,linux-ssh
    notes Database server
    address 192.168.0.67
    contact_groups +dba
    }

    When checking in Thruk interface for the configuration it gets, I have:
    host config : contact_groups = it_team,dba_team
    service config: contact_groups = it_team


    Why is the contact_groups dba not added to services monitored by linux-ssh pack ?
    How can I do that (without complicated pack duplication etc...) ?


    Thanks for reading
    ATI

  3. #3
    Shinken project leader
    Join Date
    May 2011
    Location
    Bordeaux (France)
    Posts
    2,131
    For the first pont you can give a try to the "setvice_override" property on your hosts

    For the second, just remove contacts&groups from your service/service template definitions, and it will then use the host one, so your host configuration will be ok
    No direct support by personal message. Please open a thread so everyone can see the solution

  4. #4
    Junior Member
    Join Date
    Aug 2014
    Location
    Paris, France
    Posts
    21
    1- Indeed, should work. It requires me to rethink the way I organized things ( probably need to do still another template for hosts with http checks if I then want to use the option: service_overrides http,check_interval 10
    (just because I splitted my templates in "normal" checks, and "priority" checks only for the moment.)
    I'll dig into that. (well, see 2-bis part below)


    2- Yes it works !
    my templates/generic-service.cfg file had a contact / so value defined in a specific host.cfg file did not override this default contact for services....
    Not clear why though, especially when I read the inheritance page ( http://shinken.readthedocs.io/en/lat...ht=inheritance ) and check the graphic with the 8 colored bubble.
    Anyway, just removed the contact from generic-service.cfg, and now it works fine (the one from generic-host.cfg , + the one from hosts/web.cfg are working)

    2-bis- It works for contacts at least, but not for check_interval ? nor retry_interval ?
    These 2 values are indeed not in the "implied inheritance" list (here: http://shinken.readthedocs.io/en/lat...ed-inheritance )
    But that would just force me to :
    -either duplicate the full pack (to use a different generic-service-2.cfg template )
    -or use loads of service_overrides in many different templates to be able to manage my groups of hosts ( 1 groups would be priority checks for linux-ssh / 1 group would be priority checks for http / yet another group would be priority checks for http & linux-ssh ...)=> meaning 3 generic-host-X/Y/Z.cfg templates
    ... Or is there a simpler way ?
    I'll go for the 3 additional hosts templates method if my understanding is correct.



    3- Thanks Naparuba for your help!
    ATI

  5. #5
    Junior Member
    Join Date
    Aug 2014
    Location
    Paris, France
    Posts
    21
    Note: I don't know if it's possible, but it would be a lot simpler if service could inherit all variables from hosts (at least variables they have in common).
    Instead of having a list of only 3 variables that can benefit from this behavior (list here http://shinken.readthedocs.io/en/lat...ed-inheritance )
    I could factorize most of my config in few configuration files (hosts templates mainly).

    Just a remark, from my point of view
    ATI

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

    They are indeed not inherited (cf: https://github.com/naparuba/shinken/...rvice.py#L1564)

    You can just add them on this list and it will be ok.

    For your point of "by default inherit from host": why not after all Can you open a github ticket so we can exchange about it and have the other members inputs? Seems like a good idea. After all if you want a service value just put it in the service/template, and if you put a value on the host, seems legit to look first on the host because you ask for a specific behavior on this particular host (or template).

    So +1 for me, but we should look at all properties to see if there are not special case that should not be inherited maybe
    No direct support by personal message. Please open a thread so everyone can see the solution

  7. #7
    Junior Member
    Join Date
    Aug 2014
    Location
    Paris, France
    Posts
    21
    Hi

    I created a github account, and just created the ticket!
    https://github.com/naparuba/shinken/issues/1876
    ATI

  8. #8
    Shinken project leader
    Join Date
    May 2011
    Location
    Bordeaux (France)
    Posts
    2,131
    Cool thanks
    No direct support by personal message. Please open a thread so everyone can see the solution

  9. #9
    Junior Member
    Join Date
    Oct 2017
    Location
    Mumbai
    Posts
    1
    Note: I don't know whether it's conceivable, yet it would be a considerable measure less complex if the administration could acquire all factors from has (at any rate factors they have in like manner).

    Rather than having a rundown of just 3 factors that can profit from this conduct (list here http://shinken.readthedocs.io/en/lat...ed-legacy )

    I could factorize the vast majority of my config in few design records (has layouts mostly).

Posting Permissions

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