Results 1 to 9 of 9

Thread: Livestatus action_url not passing on graphite_template variable

  1. #1
    Junior Member
    Join Date
    Dec 2012
    Posts
    4

    Livestatus action_url not passing on graphite_template variable

    Hi,

    I have a working setup with Shinken + Thruk + Graphite. Performance data is sent without problems to a remote Graphite server. However I can't get $GRAPHITE_TEMPLATE$ variable into action_url. It would be cool if templates would be made available in this case, don't know if this problem is within Livestatus or in the graphite_perfdata module.

    Thanks.

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

    Re: Livestatus action_url not passing on graphite_template variable

    Where does $GRAPHITE_TEMPLATE$ macro come from? Graphite and LiveStatus are two different modules, and so they are not linked. As this macro is not a Shinken base one, LiveStatus do not know about it.
    No direct support by personal message. Please open a thread so everyone can see the solution

  3. #3
    Junior Member
    Join Date
    Dec 2012
    Posts
    4

    Re: Livestatus action_url not passing on graphite_template variable

    [quote author=naparuba link=topic=750.msg4154#msg4154 date=1358869831]
    Where does $GRAPHITE_TEMPLATE$ macro come from? Graphite and LiveStatus are two different modules, and so they are not linked. As this macro is not a Shinken base one, LiveStatus do not know about it.
    [/quote]

    Then this part of the wiki should be rewritten:

    http://www.shinken-monitoring.org/wi..._with_graphite

    define host{
    name generic-host
    [...]
    process_perf_data 1
    [...]
    #action_url http://<PNP4NAGIOS_HOST>/graphite/$GRAPHITE_TEMPLATE$
    # If not an absolute URI, it must be relative to /cgi-bin/thruk/, not /thruk/!
    action_url ../../graphite/$GRAPHITE_TEMPLATE$
    [...]
    define service{
    name generic-service
    [...]
    process_perf_data 1
    [...]
    action_url http://<GRAPHITE_HOST>/graphite/$GRAPHITE_TEMPLATE$

    And if this is not working, I think it should be implemented.

  4. #4
    Senior Member
    Join Date
    Nov 2011
    Posts
    147

    Re: Livestatus action_url not passing on graphite_template variable

    Ok, I'm about to clarify this page : http://www.shinken-monitoring.org/wi..._with_graphite

    The first parts, in my opinion, are ok.
    The last one, action_url, is , .... not ok, in my opinion.

    Let me explain how I see it :
    • [li]With Shinken UI[/li]

    You have to possibility to use graphite template files. They are located in "templates_path", (from the graphite_webui module)
    They are file containing graphite urls with shinken contextual variables.
    Ex :
    ${uri}render/?width=586&height=308&target=alias(legendV alue(${host}.${service}.'user'%2C%22last%22)%2C%22User%22)&amp ;target=alias(legendValue(${host}.${service}.'sys'%2C%22last%22)%2C%22Sys%22)&t arget=alias(legendValue(${host}.${service}.'softirq'%2C%22last%22)%2C%22SoftIRQ%2 2)&target=alias(legendValue(${host}.${service}.'nice'%2C%22last%22)%2C%22Nice%22)&amp ;target=alias(legendValue(${host}.${service}.'irq'%2C%22last%22)%2C%22IRQ%22)&t arget=alias(legendValue(${host}.${service}.'iowait'%2C%22last%22)%2C%22I%2FO%20Wa it%22)&target=alias(legendValue(${host}.${service}.'idle'%2C%22last%22)%2C%22Idle%22)&amp ;fgcolor=000000&bgcolor=FFFFFF)&areaMode=s tacked&yMax=100
    is used for check_cpu. Split this string using & as a separator to understand it. It's quite easy. Use graphite uri api doc.

    Shinken uses the templates tht matches the check_command, like pnp does.
    • [li]Thruk[/li]

    Thruk offers a proper integration with PNP, but not with Graphite.
    Still, you can use graphite with Thruk. Simply use the action_url for your service/host to link toward the graphite url you want. Use HOSTNAME and SERVICEDESC macros.
    The action_url icon will be a link to the graph in Thruk UI.
    For ex :

    http://MYGRAPHITE/render/?lineMode=connected&width=586&height=308&a mp;_salt=1355923874.899&target=cactiStyle($HOS TNAME$.$SERVICEDESC$.*)&xFormat=%25H%3A%25M&am p;tz=Europe/Paris&bgcolor=DDDDDD&fgcolor=111111&ma jorGridLineColor=black&minorGridLineColor=grey

    is what I use in my Thruk.

    A change has been pushed in thruk's github to grant Thruk the features it has for pnp to graphite. The rule above (use action_url) still applies. Graphite will be displayed when the action_url contains the keyword "render".

    [/list]


    Like Nap said, I don't know where that macro GRAPHTE_TEMPLATE came from.

    Are you ok, with this quick doc ? I will add link to the graphite url doc.

  5. #5

    Re: Livestatus action_url not passing on graphite_template variable

    Nice tip on the action_url for Thruk!
    It worked (more or less) with Check_MK also.

    Only problem that I face is that my hosts are FQDN and this didn't match what is graphite expects as graphite changes dots to underscores.
    I thought about creating a small PHP script just to do this char change but maybe later

  6. #6
    Junior Member
    Join Date
    Dec 2012
    Posts
    4

    Re: Livestatus action_url not passing on graphite_template variable

    Yep, I experience the same problem with dots and underscores as I also use FQDN names for my hostnames(doesn't everybody?).

    @H4wkmoon is there a way to fix this in some way, probably in the thruk interface?

  7. #7
    Senior Member
    Join Date
    Nov 2011
    Posts
    147

    Re: Livestatus action_url not passing on graphite_template variable

    Hum, the easiest solution I see is the creation in shinken of new macros.
    They would contain the "cleaned" name of the host/service, as sent to graphite.

    Or, you can create a custom field for each host & service, with the value sent to graphite, and use this custom macro in the action url.

    Code:
    define host {
    
    use blabla
    host_name this.is.a.very.long.name
    _clean this_is_a_very_long_name
    ...
    }
    action_url would be :
    action_url http://MYGRAPHITE/render/?lineMode=connected&width=586&height=308&a mp;_salt=1355923874.899&target=cactiStyle($_HOSTCLEAN$.$SERVICEDESC$.*)&xFormat=%25H%3A%25M&tz= Europe/Paris&bgcolor=DDDDDD&fgcolor=111111&ma jorGridLineColor=black&minorGridLineColor=grey

  8. #8
    Junior Member
    Join Date
    Aug 2013
    Posts
    3

    Re: Livestatus action_url not passing on graphite_template variable

    [quote author=H4wkmoon link=topic=750.msg4287#msg4287 date=1360681324]
    Hum, the easiest solution I see is the creation in shinken of new macros.
    They would contain the "cleaned" name of the host/service, as sent to graphite.

    Or, you can create a custom field for each host & service, with the value sent to graphite, and use this custom macro in the action url.

    Code:
    define host {
    
    use blabla
    host_name this.is.a.very.long.name
    _clean this_is_a_very_long_name
    ...
    }
    action_url would be :
    action_url http://MYGRAPHITE/render/?lineMode=connected&width=586&height=308&a mp;_salt=1355923874.899&target=cactiStyle($_HOSTCLEAN$.$SERVICEDESC$.*)&xFormat=%25H%3A%25M&tz= Europe/Paris&bgcolor=DDDDDD&fgcolor=111111&ma jorGridLineColor=black&minorGridLineColor=grey
    [/quote]

    It does not work because thruk does not parse user-defined macros. As I've just understand, thruk can parse only default nagios-based macros

  9. #9
    Senior Member
    Join Date
    Nov 2011
    Posts
    147

    Re: Livestatus action_url not passing on graphite_template variable

    It does not work because thruk does not parse user-defined macros
    Yes, ti does work. Thruk parses user-definied macro, and even allows you to set them in its config pages.

Posting Permissions

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