Results 1 to 6 of 6

Thread: [RESOLVED]Multiple inheritance problem in service definition with shinken 0.6.99

  1. #1

    [RESOLVED]Multiple inheritance problem in service definition with shinken 0.6.99

    I installed shinken via omd (first 0.48 with shinken 0.6.4 and now 0.50 with shinken 0.6.99) and had a problem with multiple inheritance. Here is an extract of my config:
    Code:
    define service {
      name         srv-pnp
      process_perf_data  1
      action_url      /integ/pnp4nagios/index.php/graph?host=$HOSTNAME$&srv=$SERVICEDESC$' class='tips' rel='/integ/pnp4nagios/index.php/popup?host=$HOSTNAME$&srv=$SERVICEDESC$
      register       0
    }
    # Base template for all services
    define service{
        name      base-service
        register    0
        use       srv-pnp
    }
    
    # Base template for prod (24x7, 5" alert delai)
    define service{
        name          base-service-prod
        register        0
        use           base-service
        check_interval     3
        max_check_attempts   3
        retry_interval     1
    }
    
    # Addon template for checks with no graphs
    define service{
        name          no-graph
        register        0
        process_perf_data    0
        action_url       null
    }
    
    # Check Name
    define service{
        use           base-service-prod,no-graph
        service_description   check_snmp_name
        display_name      SNMP sysName
        hostgroup_name     switchs
        check_command      check_snmp!-C $_HOSTsnmp_community$ -o .1.3.6.1.2.1.1.5 -n -s '"$HOSTNAME$"'
    }
    I tested to define my service Check Name with
    Code:
    use  no-graph,base-service-prod
    and
    Code:
    use  base-service-prod,no-graph
    The action_url is always set for this service (as shown by thruk) and I don't know how to check if process_perf_data is actualy set or not. If I add explicitely
    Code:
    action_url  null
    in the service definition, it works as I want.

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

    Re: Multiple inheritance problem in service definition with shinken 0.6.99

    Hi,

    Gerhard pushed a patch yesterday in the git source that can solve your problem. Can you test it?

    Thanks
    No direct support by personal message. Please open a thread so everyone can see the solution

  3. #3

    Re: Multiple inheritance problem in service definition with shinken 0.6.99

    Tested the patch, it as no effects on my problem. But it gives me the road to the code…
    I found the place where the object.cache is stored so I could view the extact state of my objects.

    The prop process_perf_data from my templates is correct with additive inheritance, when my service use "no-graph,base-service-prod", it is setted to 0 as in the first template "no-graph".

    The problem is with the null string in action_url, if I look at the code in item.py, the logic in the recursive function "get_property_by_inheritance(self, items, prop)" is not good when a prop is setted to "null" in a template, the function will return None as if the prop is no setted, so the value will be taken from the next template in the list…

    I think, a template as to return the string "null" if it have the prop so we can have a stop condition. I will have impact on the has_plus conditions as the string "null" must not be hadded here. Even I can read it, I don't think I am able to write a patch for now…

    Thank you for this great piece of software

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

    Re: Multiple inheritance problem in service definition with shinken 0.6.99

    Good analysis

    I'll try wrote a test case and solve this
    No direct support by personal message. Please open a thread so everyone can see the solution

  5. #5

    Re: Multiple inheritance problem in service definition with shinken 0.6.99

    It's solved. ;D

    Gerhard

  6. #6

    Re: Multiple inheritance problem in service definition with shinken 0.6.99

    Thank U, I applied the patch on my install. I can now use my no-graph template, will remove a lot of useless lines

Posting Permissions

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