action_url for inline graph with Naemon/Thruk/Nagiosgraph not working

  • Hi all,



    I have problem porting the template to display inline nagiosgraph service graphs from Nagios3/nagiosgraph to Naemon/Thruk/nagiosgraph.


    If no event handling is configured, in Thruk, if I click on the "Perform Extra Servive Action" icon, I'm correctly redirected to the page containing the nagiosgraph graphs.
    If I add the onMouse events, a weird link is rendered and both actions (click and event) does not work correctly.



    I have following configuration:
    - RHEL 7.2
    - Naemon 1.0.3
    - Thruk 2.06
    - Nagiosgraph 1.5.2



    Thanks for any help.


    anto




    Thruk parameters:


    Code
    1. $ cat /etc/thruk/cgi.cfg
    2. ...
    3. escape_html_tags=0
    4. action_url_target=_blank
    5. ...








    Template action_url test 1


    No event handling, works as expected.

    in browser rendered link:

    Code
    1. ...
    2. <tr>
    3. <td align="center" valign="middle">
    4. <a href="/nagiosgraph/cgi-bin/show.cgi?host=fw-eng1.eng.my.com&service=FWMON_SM1_INTERFACE_eth1" target="_blank">
    5. <img class="clickable" src="/thruk/themes/Thruk/images/action.gif" alt="Perform Extra Service Actions" title="Perform Extra Service Actions" border="0" height="20" width="20">
    6. </a>
    7. </td>
    8. </tr>
    9. ...








    Template action_url test 2


    MouseOver event handling, configured with single quote. Does not work.


    in browser rendered link:

    Code
    1. ...
    2. <tr>
    3. <td align="center" valign="middle">
    4. <a href="/nagiosgraph/cgi-bin/show.cgi?host=fw-eng1.eng.my.com&service=FWMON_SM1_INTERFACE_eth1' onMouseOver='showGraphPopup(this)' onMouseOut='hideGraphPopup()' rel='/nagiosgraph/cgi-bin/showgraph.cgi?host=fw-eng1.eng.my.com&service=FWMON_SM1_INTERFACE_eth1&period=day&rrdopts=-w+450" target="_blank">
    5. <img class="clickable" src="/thruk/themes/Thruk/images/action.gif" alt="Perform Extra Service Actions" title="Perform Extra Service Actions" border="0" height="20" width="20">
    6. </a>
    7. </td>
    8. </tr>








    Template action_url test 3


    MouseOver event handling, configured with double quote. Does not work.


    Code
    1. $ cat /etc/naemon/conf.d/templates.cfg
    2. define service {
    3. name graphed-service-interface
    4. ...
    5. action_url /nagiosgraph/cgi-bin/show.cgi?host=$HOSTNAME$&service=$SERVICEDESC$" onMouseOver="showGraphPopup(this)" onMouseOut="hideGraphPopup()" rel="/nagiosgraph/cgi-bin/showgraph.cgi?host=$HOSTNAME$&service=$SERVICEDESC$&period=day&rrdopts=-w+450
    6. ...
    7. }

    in browser rendered link:

    Code
    1. ...
    2. <tr>
    3. <td align="center" valign="middle">
    4. <a href="/nagiosgraph/cgi-bin/show.cgi?host=fw-eng1.eng.my.com&service=FWMON_SM1_INTERFACE_eth1&quot; onMouseOver=&quot;showGraphPopup(this)&quot; onMouseOut=&quot;hideGraphPopup()&quot; rel=&quot;/nagiosgraph/cgi-bin/showgraph.cgi?host=fw-eng1.eng.my.com&service=FWMON_SM1_INTERFACE_eth1&period=day&rrdopts=-w+450" target="_blank">
    5. <img class="clickable" src="/thruk/themes/Thruk/images/action.gif" alt="Perform Extra Service Actions" title="Perform Extra Service Actions" border="0" height="20" width="20">
    6. </a>
    7. </td>
    8. </tr>








    Template action_url for the old Nagios 3 + Nagiosgraph


    MouseOver event handling, configured with single quote. Works as expected.


    -----
    From Nagios/nagiosgrapher

    Code
    1. $ cat /etc/nagios/conf.d/templates.cfg
    2. define service {
    3. name graphed-service-interface
    4. ...
    5. action_url /nagiosgraph/cgi-bin/show.cgi?host=$HOSTNAME$&service=$SERVICEDESC$' onMouseOver='showGraphPopup(this)' onMouseOut='hideGraphPopup()' rel='/nagiosgraph/cgi-bin/showgraph.cgi?host=$HOSTNAME$&service=$SERVICEDESC$&period=day&rrdopts=-w+450
    6. ...
    7. }

    in browser rendered link:

    Code
    1. ...
    2. <tr>
    3. <td align="center" valign="center">
    4. <a href="/nagiosgraph/cgi-bin/show.cgi?host=fw-eng1.eng.my.com&service=FWMON_SM1_INTERFACE_eth3" onmouseover="showGraphPopup(this)" onmouseout="hideGraphPopup()" rel="/nagiosgraph/cgi-bin/showgraph.cgi?host=fw-eng1.eng.my.com&service=FWMON_SM1_INTERFACE_eth3&period=day&rrdopts=-w+450" target="_blank">
    5. <img src="/nagios/images/action.gif" alt="Perform Extra Service Actions" title="Perform Extra Service Actions" border="0" height="20" width="20">
    6. </a>
    7. </td>
    8. </tr>
  • Thanks.


    With title="/pnp/" does not work, but "emulating" the pnp4nagios path, it works.


    Fixed action_url:


    Code
    1. $ cat /etc/nagios/conf.d/templates.cfg
    2. define service {
    3. name graphed-service-interface
    4. ...
    5. action_url /pnp/cgi-bin/show.cgi?host=$HOSTNAME$&service=$SERVICEDESC$' onMouseOver='showGraphPopup(this)' onMouseOut='hideGraphPopup()' rel='/pnp/cgi-bin/showgraph.cgi?host=$HOSTNAME$&service=$SERVICEDESC$&period=day&rrdopts=-w+450
    6. ...
    7. }


    Fixed nagiosgrapher.conf


    Code
    1. $ cat /etc/httpd/conf.d/nagiosgraph.conf
    2. ...
    3. # enable nagiosgraph CGI scripts
    4. ScriptAlias /pnp/cgi-bin "/usr/app/nagiosgraph/cgi"
    5. Alias /pnp "/usr/app/nagiosgraph/share"
    6. ...