diff options
| author | hugetoad <hugetoad@97f52cf1-0a1b-0410-bd0e-c28be96e8082> | 2001-07-08 15:44:10 +0000 |
|---|---|---|
| committer | hugetoad <hugetoad@97f52cf1-0a1b-0410-bd0e-c28be96e8082> | 2001-07-08 15:44:10 +0000 |
| commit | 06b0209984cd7d65fdd4ed5ffeb965f7e894f6c7 (patch) | |
| tree | 39449be83e3fb3b99f81897e2478a1857427dd96 /frontends/php | |
| parent | ade87bab8d26dd4a23a1e96e9e13ae3158999696 (diff) | |
Color attribute added to each parameter of graph.
git-svn-id: svn://svn.zabbix.com/trunk@132 97f52cf1-0a1b-0410-bd0e-c28be96e8082
Diffstat (limited to 'frontends/php')
| -rw-r--r-- | frontends/php/chart2.html | 30 | ||||
| -rw-r--r-- | frontends/php/graph.html | 29 | ||||
| -rw-r--r-- | frontends/php/include/config.inc | 6 | ||||
| -rw-r--r-- | frontends/php/items.html | 9 |
4 files changed, 44 insertions, 30 deletions
diff --git a/frontends/php/chart2.html b/frontends/php/chart2.html index b704faac..6ee202c2 100644 --- a/frontends/php/chart2.html +++ b/frontends/php/chart2.html @@ -33,16 +33,18 @@ $nodata=1; -// Header( "Content-type: text/html"); - Header( "Content-type: image/png"); + Header( "Content-type: text/html"); +// Header( "Content-type: image/png"); Header( "Expires: Mon, 17 Aug 1998 12:51:50 GMT"); $im = imagecreate($sizeX+$shiftX+61,$sizeY+$shiftYup+$shiftYdown+10); $red=ImageColorAllocate($im,255,0,0); + $darkred=ImageColorAllocate($im,150,0,0); $green=ImageColorAllocate($im,0,255,0); $darkgreen=ImageColorAllocate($im,0,150,0); $blue=ImageColorAllocate($im,0,0,255); + $darkblue=ImageColorAllocate($im,0,0,150); $yellow=ImageColorAllocate($im,255,255,0); $cyan=ImageColorAllocate($im,0,255,255); $black=ImageColorAllocate($im,0,0,0); @@ -51,11 +53,15 @@ $colors=array(); - $color[0]=$green; - $color[1]=$yellow; - $color[2]=$blue; - $color[3]=$white; - $color[4]=$cyan; + $colors["Green"]=$green; + $colors["Dark Green"]=$darkgreen; + $colors["Yellow"]=$yellow; + $colors["Blue"]=$blue; + $colors["Dark Blue"]=$blue; + $colors["White"]=$white; + $colors["Cyan"]=$cyan; + $colors["Red"]=$red; + $colors["Dark Red"]=$darkred; $x=imagesx($im); $y=imagesy($im); @@ -74,12 +80,13 @@ $from_time = time(NULL)-$period-3600*$from; $to_time = time(NULL)-3600*$from; - $result2=DBselect("select gi.itemid,i.description from graphs_items gi,items i where gi.itemid=i.itemid and gi.graphid=$graphid order by gi.gitemid"); + $result2=DBselect("select gi.itemid,i.description,gi.color from graphs_items gi,items i where gi.itemid=i.itemid and gi.graphid=$graphid order by gi.gitemid"); $len=array(); $x=array(); $y=array(); $desc=array(); + $color=array(); $maxX=-1000000000; $maxY=-1000000000; @@ -90,6 +97,7 @@ { $itemid=DBget_field($result2,$item,0); $desc[$item]=DBget_field($result2,$item,1); + $color[$item]=DBget_field($result2,$item,2); $result=DBselect("select clock,value from history where itemid=$itemid and clock>$from_time and clock<$to_time order by clock"); $len[$item]=0; @@ -127,14 +135,14 @@ $y2=$sizeY-$y2; // echo $x1," - ",$x2," - ",$y1," - ",$y2,"<Br>"; - ImageLine($im,$x1+$shiftX,$y1+$shiftYup,$x2+$shiftX,$y2+$shiftYup,$color[$item]); + ImageLine($im,$x1+$shiftX,$y1+$shiftYup,$x2+$shiftX,$y2+$shiftYup,$colors[$color[$item]]); } } else { - ImageLine($im,$shiftX,$shiftYup+$sizeY/2,$sizeX+$shiftX,$shiftYup+$sizeY/2,$color[$item]); + ImageLine($im,$shiftX,$shiftYup+$sizeY/2,$sizeX+$shiftX,$shiftYup+$sizeY/2,$colors[$color[$item]]); } - ImageFilledRectangle($im,$shiftX+150*$item,$sizeY+$shiftYup+19,$shiftX+150*$item+5,$sizeY+$shiftYup+15+9,$color[$item]); + ImageFilledRectangle($im,$shiftX+150*$item,$sizeY+$shiftYup+19,$shiftX+150*$item+5,$sizeY+$shiftYup+15+9,$colors[$color[$item]]); ImageString($im, 2,$shiftX+150*$item+9,$sizeY+$shiftYup+15, $desc[$item], $gray); } diff --git a/frontends/php/graph.html b/frontends/php/graph.html index cb1615fc..dca018cb 100644 --- a/frontends/php/graph.html +++ b/frontends/php/graph.html @@ -15,11 +15,7 @@ { if($register=="add") { - add_item_to_graph($graphid,$itemid); - } - if($register=="add link") - { - add_link($sysmapid,$shostid1,$shostid2); + add_item_to_graph($graphid,$itemid,$color); } if($register=="delete") { @@ -45,10 +41,11 @@ echo "<TABLE BORDER=0 COLS=4 WIDTH=\"100%\" BGCOLOR=\"#CCCCCC\" cellspacing=1 cellpadding=3>"; echo "<TD WIDTH=\"10%\" NOSAVE><B>Host</B></TD>"; echo "<TD WIDTH=\"10%\" NOSAVE><B>Parameter</B></TD>"; + echo "<TD WIDTH=\"10%\" NOSAVE><B>Color</B></TD>"; echo "<TD WIDTH=\"10%\" NOSAVE><B>Actions</B></TD>"; echo "</TR>"; - $sql="select i.itemid,h.host,i.description,gi.gitemid from hosts h,graphs_items gi,items i where i.itemid=gi.itemid and gi.graphid=$graphid and h.hostid=i.hostid"; + $sql="select i.itemid,h.host,i.description,gi.gitemid,gi.color from hosts h,graphs_items gi,items i where i.itemid=gi.itemid and gi.graphid=$graphid and h.hostid=i.hostid"; $result=DBselect($sql); echo "<CENTER>"; $col=0; @@ -68,9 +65,11 @@ $host_=DBget_field($result,$i,1); $description_=DBget_field($result,$i,2); $gitemid_=DBget_field($result,$i,3); + $color_=DBget_field($result,$i,4); echo "<TD>$host_</TD>"; echo "<TD><a href=\"chart.html?itemid=$itemid_&period=3600&from=0\">$description_</a></TD>"; + echo "<TD>$color_</TD>"; echo "<TD><A HREF=\"graph.html?register=delete&graphid=$graphid&gitemid=$gitemid_\">Delete</A></TD>"; echo "</TR>"; } @@ -90,7 +89,8 @@ { echo "<input name=\"gitemid\" type=\"hidden\" value=$gitemid>"; } - echo "Host"; + + echo "Parameter"; show_table2_h_delimiter(); $result=DBselect("select h.host,i.description,i.itemid from hosts h,items i where h.hostid=i.hostid order by h.host,i.description"); echo "<select name=\"itemid\" size=1>"; @@ -103,6 +103,21 @@ } echo "</SELECT>"; + show_table2_v_delimiter(); + echo "Color"; + show_table2_h_delimiter(); + echo "<select name=\"color\" size=1>"; + echo "<OPTION VALUE='Green'>Green"; + echo "<OPTION VALUE='Dark Green'>Dark green"; + echo "<OPTION VALUE='Red'>Red"; + echo "<OPTION VALUE='Dark Red'>Dark red"; + echo "<OPTION VALUE='Cyan'>Cyan"; + echo "<OPTION VALUE='Yellow'>Yellow"; + echo "<OPTION VALUE='Blue'>Blue"; + echo "<OPTION VALUE='Dark Blue'>Dark Blue"; + echo "<OPTION VALUE='White'>White"; + echo "</SELECT>"; + show_table2_v_delimiter2(); echo "<input type=\"submit\" name=\"register\" value=\"add\">"; diff --git a/frontends/php/include/config.inc b/frontends/php/include/config.inc index 9066fbf2..b098bc32 100644 --- a/frontends/php/include/config.inc +++ b/frontends/php/include/config.inc @@ -197,7 +197,7 @@ { Header("WWW-authenticate: basic realm=\"Zabbix\""); Header("HTTP/1.0 401 Unauthorized"); - echo "Try to contact System Administrator to get additional rights :-)\n"; + echo "Try to contact Zabbix Administrator to get additional rights :-)\n"; exit; } @@ -980,9 +980,9 @@ $result=DBexecute($sql); } - function add_item_to_graph($graphid,$itemid) + function add_item_to_graph($graphid,$itemid,$color) { - $sql="insert into graphs_items (graphid,itemid) values ($graphid,$itemid)"; + $sql="insert into graphs_items (graphid,itemid,color) values ($graphid,$itemid,'$color')"; $result=DBexecute($sql); } diff --git a/frontends/php/items.html b/frontends/php/items.html index 0dfc1af4..e9dad0a7 100644 --- a/frontends/php/items.html +++ b/frontends/php/items.html @@ -106,10 +106,6 @@ cr(); echo "<TD WIDTH=\"5%\" NOSAVE><B>Status</B></TD>"; cr(); - echo "<TD WIDTH=\"5%\" NOSAVE><B>Lastdelete</B></TD>"; - cr(); - echo "<TD WIDTH=\"5%\" NOSAVE><B>Nextcheck</B></TD>"; - cr(); echo "<TD WIDTH=\"5%\" NOSAVE><B>Actions</B></TD>"; cr(); echo "</TR>"; @@ -137,8 +133,6 @@ $lastclock=date("y/m/d H:i:s",DBget_field($result,$i,9)); $itemid_=DBget_field($result,$i,2); $status=DBget_field($result,$i,9); - $lastdelete=date("y/m/d H:i:s",DBget_field($result,$i,10)); - $nextcheck=date("y/m/d H:i:s",DBget_field($result,$i,11)); echo "<TD>$host</TD>"; echo "<TD>$key</TD>"; echo "<TD>$description</TD>"; @@ -156,9 +150,6 @@ else echo "<TD ALIGN=CENTER><B>$status</B> Unknown</TD>"; echo "</td>"; - echo "<TD>$lastdelete</TD>"; - echo "<TD>$nextcheck</TD>"; - if(isset($hostid_)) { echo "<TD><A HREF=\"items.html?hostid=$hostid_&itemid=$itemid_#form\">Change</A></TD>"; |
