Ad Widget

Collapse

Partial patch to add all graphs support.

Collapse
X
  • Filter
  • Time
  • Show
Clear All
new posts

    Partial patch to add all graphs support.

    Zabbix Devs,

    I find it very useful to see more than one graph at a time so I went to go create a patch that would add 'All' to the graph drop down which would allow you to view all of the graphs for a host. While I thought this would be real simple, the form validation kept getting in the way because it converts $_REQUEST["graphid"] to zero whenever an invalid graphid is used. Furthermore, graphid 0 seems to be the default and thus is already used by the app.

    To work around the validation I used graphid 0.1 as the graphid for displaying all of the graphs, but that foces me to use $_GET instead of $_REQUEST in one part of the app. Now this shouldn't cause a security problem because it is never used in a SQL query, it is still a hack.

    Anyway, can someone look at my patch and tell me what the zabbix way of doing this is?

    diff -ruN zabbix.orig/charts.php zabbix/charts.php
    --- zabbix.orig/charts.php 2006-06-06 10:20:41.000000000 -0800
    +++ zabbix/charts.php 2006-06-06 11:41:37.000000000 -0800
    @@ -162,6 +162,7 @@
    $h2=$h2.SPACE.S_GRAPH.SPACE;
    $h2=$h2."<select class=\"biginput\" name=\"graphid\" onChange=\"submit()\">";
    $h2=$h2.form_select("graphid",0,S_SELECT_GRAPH_DOT _DOT_DOT);
    + $h2=$h2.form_select("graphid",0.1,S_SELECT_GRAPH_A LL);

    if($_REQUEST["hostid"] > 0)
    {
    @@ -201,7 +202,18 @@
    echo "<TABLE BORDER=0 align=center COLS=4 WIDTH=100% BGCOLOR=\"#CCCCCC\" cellspacing=1 cellpadding=3>";
    echo "<TR BGCOLOR=#DDDDDD>";
    echo "<TD ALIGN=CENTER>";
    - if($_REQUEST["graphid"] > 0)
    + if($_GET["graphid"] == 0.1)
    + {
    + echo "<script language=\"JavaScript\">";
    + $result=DBselect("select distinct gi.graphid as graphid from items i, graphs_items gi where gi.itemid = i.itemid and hostid=".$_REQUEST["hostid"]);
    + while($row=DBfetch($result))
    + {
    + echo "document.write(\"<IMG SRC='chart2.php?graphid=".$row["graphid"].url_param("stime")."&period=".$effectiveperiod."& from=".$_REQUEST["from"]."&width=\"+(document.width-108)+\"'><p>\");";
    + }
    + echo "</script>";
    + navigation_bar("charts.php");
    + }
    + elseif($_REQUEST["graphid"] > 0)
    {
    echo "<script language=\"JavaScript\">";
    echo "document.write(\"<IMG SRC='chart2.php?graphid=".$_REQUEST["graphid"].url_param("stime")."&period=".$effectiveperiod."& from=".$_REQUEST["from"]."&width=\"+(document.width-108)+\"'>\")";
    diff -ruN zabbix.orig/include/locales/en_gb.inc.php zabbix/include/locales/en_gb.inc.php
    --- zabbix.orig/include/locales/en_gb.inc.php 2006-05-25 08:02:17.000000000 -0800
    +++ zabbix/include/locales/en_gb.inc.php 2006-06-06 11:35:18.000000000 -0800
    @@ -157,6 +157,7 @@
    "S_RIGHT_DIR"=> "Right",
    "S_LEFT_DIR"=> "Left",
    "S_SELECT_GRAPH_DOT_DOT_DOT"=> "Select graph...",
    + "S_SELECT_GRAPH_ALL"=> "All",

    // Colors
    "S_BLACK"=> "Black",

    #2
    I used this patch when I was running an older version of Zabbix server and it really helped me to get a quick complete view over the entire host.
    At the moment I need to make a screen for every host to get the same kind of result and with a lot of hosts it is very time consuming.

    And again I have the same question. Alexei, would it be possible to implement that functionality in future release of Zabbix?

    Comment


      #3
      template

      i think it should be cool to be able to create something like 'screen template' so it won't be needed to create screens for ever host separately. but this 'all graphs' idea looks fine too.

      Comment


        #4
        Originally posted by azurit View Post
        i think it should be cool to be able to create something like 'screen template' so it won't be needed to create screens for ever host separately. but this 'all graphs' idea looks fine too.
        It is already implemented in pre-1.6.
        Alexei Vladishev
        Creator of Zabbix, Product manager
        New York | Tokyo | Riga
        My Twitter

        Comment


          #5
          Originally posted by Alexei View Post
          It is already implemented in pre-1.6.
          im using 1.6.1 where do i get to choose all graphs for a host, i cant find it.

          Best regards,

          NHIan

          Comment


            #6
            probably the svn 1.6 branch
            svn://svn.zabbix.com/branches/1.6/

            Comment

            Announcement

            Collapse
            No announcement yet.
            Working...
            X