summaryrefslogtreecommitdiffstats
path: root/frontends
diff options
context:
space:
mode:
authorhugetoad <hugetoad@97f52cf1-0a1b-0410-bd0e-c28be96e8082>2002-01-06 16:24:43 +0000
committerhugetoad <hugetoad@97f52cf1-0a1b-0410-bd0e-c28be96e8082>2002-01-06 16:24:43 +0000
commit38d78876d1e4914a21682ae7a319fc1f98a6c4db (patch)
tree8f9f2ab4ec161f6d5c47848fbcf71d3b7d129cae /frontends
parentecddd05681ba3efc23d8a1e80edcd4f35446def3 (diff)
downloadzabbix-38d78876d1e4914a21682ae7a319fc1f98a6c4db.tar.gz
zabbix-38d78876d1e4914a21682ae7a319fc1f98a6c4db.tar.xz
zabbix-38d78876d1e4914a21682ae7a319fc1f98a6c4db.zip
- added user-defined sorting to form "Latest Values" (Alexei)
- extra debug information in case of network errors in zabbix_suckerd (Alexei) git-svn-id: svn://svn.zabbix.com/trunk@275 97f52cf1-0a1b-0410-bd0e-c28be96e8082
Diffstat (limited to 'frontends')
-rw-r--r--frontends/php/actions.html64
-rw-r--r--frontends/php/alerts.html21
-rw-r--r--frontends/php/chart.html19
-rw-r--r--frontends/php/include/config.inc17
-rw-r--r--frontends/php/items.html126
-rw-r--r--frontends/php/latest.html108
-rw-r--r--frontends/php/report2.html34
-rw-r--r--frontends/php/services.html17
-rw-r--r--frontends/php/srv_status.html43
-rw-r--r--frontends/php/tr_status.html172
-rw-r--r--frontends/php/triggers.html58
11 files changed, 362 insertions, 317 deletions
diff --git a/frontends/php/actions.html b/frontends/php/actions.html
index 4b8011a9..7d4390b7 100644
--- a/frontends/php/actions.html
+++ b/frontends/php/actions.html
@@ -55,49 +55,32 @@
$col=0;
while($row=DBfetch($result))
{
- $actid=DBget_field($result,$i,0);
- $good="OFF";
- if(DBget_field($result,$i,3))
- {
- $good="ON";
- }
- $to=DBget_field($result,$i,2);
- $delay=DBget_field($result,$i,4);
- $subject=DBget_field($result,$i,5);
- $msg=DBget_field($result,$i,6);
-
- if(isset($actionid) && ($actionid==$actid))
+ if(isset($actionid) && ($actionid==$row["actionid"]))
{
echo "<TR BGCOLOR=#FFDDDD>";
- $col=$col+1;
- $sactid=$actid;
- $sgood=$good;
- $sto=$to;
- $sdelay=$delay;
- $ssubject=$subject;
- $smsg=$msg;
+ $col++;
}
else
{
- if($col==1)
- {
- echo "<TR BGCOLOR=#EEEEEE>";
- $col=0;
- } else
- {
- echo "<TR BGCOLOR=#DDDDDD>";
- $col=1;
- }
+ if($col++%2 == 1) { echo "<TR BGCOLOR=#EEEEEE>"; }
+ else { echo "<TR BGCOLOR=#DDDDDD>"; }
}
- echo "<TD>$to</TD>";
- echo "<TD>$good</TD>";
- echo "<TD>$delay</TD>";
- echo "<TD>$subject</TD>";
- echo "<TD>$msg</TD>";
+ echo "<TD>".$row["alias"]."</TD>";
+ if($row["good"])
+ {
+ echo "<TD>ON</TD>";
+ }
+ else
+ {
+ echo "<TD>OFF</TD>";
+ }
+ echo "<TD>".$row["delay"]."</TD>";
+ echo "<TD>".$row["subject"]."</TD>";
+ echo "<TD>".$row["message"]."</TD>";
echo "<TD>";
- echo " <A HREF=\"actions.html?register=edit&actionid=$actid&triggerid=$triggerid\">Edit</A>";
- echo ", <A HREF=\"actions.html?register=delete&actionid=$actid&triggerid=$triggerid\">Delete</A>";
+ echo " <A HREF=\"actions.html?register=edit&actionid=".$row["actionid"]."&triggerid=".$row["triggerid"]."\">Edit</A>";
+ echo ", <A HREF=\"actions.html?register=delete&actionid=".$row["actionid"]."&triggerid=".$row["triggerid"]."\">Delete</A>";
echo "</TD></TR>";
}
echo "</TABLE>";
@@ -133,7 +116,6 @@
$result=DBselect($sql);
$message="<INSERT YOUR MESSAGE HERE>\n\n------Latest data------\n\n";
while($row=DBfetch($result))
-// for($i=0;$i<DBnum_rows($result);$i++)
{
$message=$message.$row["description"].": \{".$row["host"].":".$row["key_"].".last(0)} (latest value)\n";
$message=$message.$row["description"].": \{".$row["host"].":".$row["key_"].".max(300)} (maximum value for last 5 min)\n";
@@ -158,17 +140,15 @@
$sql="select userid,alias from users order by alias";
$result=DBselect($sql);
- for($i=0;$i<DBnum_rows($result);$i++)
+ while($row=DBfetch($result))
{
- $id=DBget_field($result,$i,0);
- $name=DBget_field($result,$i,1);
- if(isset($sto) && ($name==$sto))
+ if(isset($sto) && ($row["name"] == $sto))
{
- echo "<option value=\"$id\" SELECTED>$name";
+ echo "<option value=\"".$row["userid"]."\" SELECTED>".$row["alias"];
}
else
{
- echo "<option value=\"$id\">$name";
+ echo "<option value=\"".$row["userid"]."\">".$row["alias"];
}
}
echo "</select>";
diff --git a/frontends/php/alerts.html b/frontends/php/alerts.html
index 2ea4cc9d..75661f01 100644
--- a/frontends/php/alerts.html
+++ b/frontends/php/alerts.html
@@ -38,24 +38,27 @@
echo "<CENTER>";
echo "<TABLE WIDTH=100% BORDER=0 BGCOLOR=\"#CCCCCC\" cellspacing=1 cellpadding=3>";
echo "<TR>";
- echo "<TD WIDTH=\"10%\"><FONT SIZE=+1>Time</FONT></TD>";
- echo "<TD WIDTH=\"5%\"><FONT SIZE=+1>Type</FONT></TD>";
- echo "<TD WIDTH=\"15%\"><FONT SIZE=+1>Send to</FONT></TD>";
- echo "<TD><FONT SIZE=+1>Subject</FONT></TD>";
- echo "<TD><FONT SIZE=+1>Message</FONT></TD>";
+ echo "<TD WIDTH=\"10%\"><b>Time</b></TD>";
+ echo "<TD WIDTH=\"5%\"><b>Type</b></TD>";
+ echo "<TD WIDTH=\"15%\"><b>Send to</b></TD>";
+ echo "<TD><b>Subject</b></TD>";
+ echo "<TD><b>Message</b></TD>";
echo "</TR>";
$col=0;
while($row=DBfetch($result))
{
if($col++%2==0) { echo "<tr bgcolor=#DDDDDD>"; }
else { echo "<tr bgcolor=#EEEEEE>"; }
+
+ echo "<TD><a href=\"alarms.html?triggerid=".$row["triggerid"]."\">".date("Y.M.d H:i:s",$row["clock"])."</a></TD>";
if($row["type"]=="EMAIL")
{
- $type="E-mail";
+ echo "<TD>E-mail</TD>";
+ }
+ else
+ {
+ echo "<TD>Unknown media type</TD>";
}
-
- echo "<TD><a href=\"alarms.html?triggerid=".$row["triggerid"]."\">".date("Y.M.d H:i:s",$row["clock"])."</a></TD>";
- echo "<TD>$type</TD>";
echo "<TD>".$row["sendto"]."</TD>";
echo "<TD>".$row["subject"]."</TD>";
echo "<TD>".$row["message"]."</TD>";
diff --git a/frontends/php/chart.html b/frontends/php/chart.html
index 19722d0b..60031cd7 100644
--- a/frontends/php/chart.html
+++ b/frontends/php/chart.html
@@ -70,15 +70,15 @@
}
else
{
- $maxX=-1000000000;
- $maxY=-1000000000;
- $minX=1000000000;
- $minY=1000000000;
+ unset($maxX);
+ unset($maxY);
+ unset($minX);
+ unset($minY);
}
// echo "MIN/MAX:",$minX," - ",$maxX," - ",$minY," - ",$maxY,"<Br>";
- if(($minX!=$maxX)&&($minY!=$maxY))
+ if(isset($minX)&&($minX!=$maxX)&&($minY!=$maxY))
{
$result=DBselect("select clock,value from history where itemid=$itemid and clock>$from_time and clock<$to_time order by clock");
for($i=0;$i<DBnum_rows($result)-1;$i++)
@@ -102,7 +102,10 @@
}
else
{
- ImageLine($im,$shiftX,$shiftY+$sizeY/2,$sizeX+$shiftX,$shiftY+$sizeY/2,$green);
+ if(isset($minX))
+ {
+ ImageLine($im,$shiftX,$shiftY+$sizeY/2,$sizeX+$shiftX,$shiftY+$sizeY/2,$green);
+ }
}
if($nodata == 0)
@@ -112,14 +115,12 @@
ImageString($im, 1, $sizeX+5+$shiftX, $sizeY-$i-4+$shiftY, $i*($maxY-$minY)/$sizeY+$minY , $red);
}
-// date("dS of F Y h:i:s A",DBget_field($result,0,0));
-
ImageString($im, 1,10, $sizeY+$shiftY+5, date("dS of F Y h:i:s A",$minX) , $red);
ImageString($im, 1,$sizeX+$shiftX-168,$sizeY+$shiftY+5, date("dS of F Y h:i:s A",$maxX) , $red);
}
else
{
- ImageString($im, 2,$sizeX/2 -50, $sizeY+$shiftY+3, "NO DATA FOUND FOR THIS PERIOD" , $red);
+ ImageString($im, 2,$sizeX/2-50, $sizeY+$shiftY+3, "NO DATA FOUND FOR THIS PERIOD" , $red);
}
ImageStringUp($im,0,2*$shiftX+$sizeX+40,$sizeY+2*$shiftY, "http://zabbix.sourceforge.net", $gray);
diff --git a/frontends/php/include/config.inc b/frontends/php/include/config.inc
index 4b6e3145..ac56cce0 100644
--- a/frontends/php/include/config.inc
+++ b/frontends/php/include/config.inc
@@ -73,6 +73,15 @@
return $host;
}
+ function get_num_of_service_childs($serviceid)
+ {
+ global $ERROR_MSG;
+
+ $sql="select count(*) from services_links where serviceupid=$serviceid";
+ $result=DBselect($sql);
+ return DBget_field($result,0,0);
+ }
+
function get_service_by_serviceid($serviceid)
{
global $ERROR_MSG;
@@ -492,11 +501,11 @@
<?
if($page["file"]=="srv_status.html")
{
- echo "<b>[SERVICES]</b></a>";
+ echo "<b>[IT SERVICES]</b></a>";
}
else
{
- echo "SERVICES</a>";
+ echo "IT SERVICES</a>";
}
?>
</font>
@@ -665,11 +674,11 @@
<?
if($page["file"]=="services.html")
{
- echo "<b>[SERVICES]</b></a>";
+ echo "<b>[IT SERVICES]</b></a>";
}
else
{
- echo "SERVICES</a>";
+ echo "IT SERVICES</a>";
}
?>
</font>
diff --git a/frontends/php/items.html b/frontends/php/items.html
index 58848672..674414c9 100644
--- a/frontends/php/items.html
+++ b/frontends/php/items.html
@@ -45,7 +45,6 @@
<?
$result=DBselect("select hostid,host from hosts order by host");
while($row=DBfetch($result))
-// for($i=0;$i<DBnum_rows($result);$i++)
{
if(isset($hostid) && ($hostid == $row["hostid"]))
{
@@ -59,7 +58,6 @@
echo " ";
}
show_table_header_end();
- echo "<br>";
$lasthost="";
if(isset($hostid)&&!isset($itemid))
@@ -67,101 +65,83 @@
$result=DBselect("select h.host,i.key_,i.itemid,i.description,h.port,i.delay,i.history,i.lastvalue,i.lastclock,i.status,i.lastdelete,i.nextcheck,h.hostid from hosts h,items i where h.hostid=i.hostid and h.hostid=$hostid order by h.host,i.key_,i.description");
echo "<CENTER>";
$col=0;
- for($i=0;$i<DBnum_rows($result);$i++)
+ while($row=DBfetch($result))
{
- $host=DBget_field($result,$i,0);
- $itemid_=DBget_field($result,$i,2);
- $hostid_=DBget_field($result,$i,12);
- // echo "\n<br><hr><b>=$host= =$lasthost=</b>\n";
- if($lasthost!=$host)
+ if($lasthost != $row["host"])
{
- if($lasthost!="")
+ if($lasthost != "")
{
echo "</TABLE><BR>";
}
- show_table_header("<A HREF='items.html?hostid=$hostid_'>$host</A>");
+ echo "<br>";
+ show_table_header("<A HREF='items.html?hostid=".$row["hostid"]."'>".$row["host"]."</A>");
echo "<TABLE BORDER=0 COLS=13 WIDTH=\"100%\" BGCOLOR=\"#CCCCCC\" cellspacing=1 cellpadding=3>";
- cr();
echo "<TR>";
- cr();
echo "<TD WIDTH=\"10%\" NOSAVE><B>Host</B></TD>";
- cr();
echo "<TD WIDTH=\"10%\" NOSAVE><B>Key</B></TD>";
- cr();
- echo "<TD WIDTH=\"10%\" ><B>Description</B></TD>";
- cr();
- echo "<TD WIDTH=\"5%\" NOSAVE><B>Delay</B></TD>";
- cr();
- echo "<TD WIDTH=\"5%\" NOSAVE><B>History</B></TD>";
- cr();
+ echo "<TD WIDTH=\"10%\" NOSAVE><B>Description</B></TD>";
+ echo "<TD WIDTH=\"5%\" NOSAVE><B>Delay</B></TD>";
+ echo "<TD WIDTH=\"5%\" NOSAVE><B>History</B></TD>";
echo "<TD><B>Shortname</B></TD>";
- cr();
echo "<TD WIDTH=\"5%\" NOSAVE><B>Status</B></TD>";
- cr();
echo "<TD WIDTH=\"5%\" NOSAVE><B>Actions</B></TD>";
- cr();
echo "</TR>";
- cr();
}
- $lasthost=$host;
- if($col==1)
- {
- echo "<TR BGCOLOR=#DDDDDD>";
- cr();
- $col=0;
- } else
- {
- echo "<TR BGCOLOR=#EEEEEE>";
- $col=1;
- }
- $host=DBget_field($result,$i,0);
- $port=DBget_field($result,$i,4);
- $delay=DBget_field($result,$i,5);
- $history=DBget_field($result,$i,6);
- $key=DBget_field($result,$i,1);
- $shortname=$host.':'.$key;
- $description=DBget_field($result,$i,3);
- $lastvalue=DBget_field($result,$i,7);
- $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);
- echo "<TD>$host</TD>";
- echo "<TD>$key</TD>";
- echo "<TD>$description</TD>";
- $description=rawurlencode($description);
- echo "<TD>$delay</TD>";
- echo "<TD>$history</TD>";
- echo "<TD>$shortname</TD>";
+ $lasthost=$row["host"];
+ if($col++%2 == 1) { echo "<TR BGCOLOR=#DDDDDD>"; }
+ else { echo "<TR BGCOLOR=#EEEEEE>"; }
+
+ echo "<TD>".$row["host"]."</TD>";
+ echo "<TD>".$row["key_"]."</TD>";
+ echo "<TD>".$row["description"]."</TD>";
+ echo "<TD>".$row["delay"]."</TD>";
+ echo "<TD>".$row["history"]."</TD>";
+ echo "<TD>".$row["host"].":".$row["key_"]."</TD>";
echo "<td align=center>";
if(isset($hostid))
{
- if($status==0) echo "<a href=\"items.html?itemid=$itemid_&hostid=$hostid&register=changestatus&status=1\">Active</a>";
- elseif($status==1) echo "<a href=\"items.html?itemid=$itemid_&hostid=$hostid&register=changestatus&status=0\">Not active</a>";
- elseif($status==2) echo "Trapper";
- elseif($status==3) echo "Not supported";
- elseif($status==10) echo "Autodisabled";
- else echo "<TD ALIGN=CENTER><B>$status</B> Unknown</TD>";
+ switch($row["status"])
+ {
+ case 0:
+ echo "<a href=\"items.html?itemid=".$row["itemid"]."&hostid=$hostid&register=changestatus&status=1\">Active</a>";
+ break;
+ case 1:
+ echo "<a href=\"items.html?itemid=$itemid_&hostid=".$row["hostid"]."&register=changestatus&status=0\">Not active</a>";
+ break;
+ case 2:
+ echo "Trapper";
+ break;
+ case 3:
+ echo "Not supported";
+ break;
+ default:
+ echo "<B>$status</B> Unknown";
+ }
}
else
{
- if($status==0) echo "<a href=\"items.html?itemid=$itemid_&register=changestatus&status=1\">Active</a>";
- elseif($status==1) echo "<a href=\"items.html?itemid=$itemid_&register=changestatus&status=0\">Not active</a>";
- elseif($status==2) echo "Trapper";
- elseif($status==3) echo "Not supported";
- elseif($status==10) echo "Autodisabled";
- else echo "<TD ALIGN=CENTER><B>$status</B> Unknown</TD>";
+ switch($row["status"])
+ {
+ case 0:
+ echo "<a href=\"items.html?itemid=".$row["itemid"]."&register=changestatus&status=1\">Active</a>";
+ break;
+ case 1:
+ echo "<a href=\"items.html?itemid=".$row["itemid"]."&register=changestatus&status=0\">Not active</a>";
+ break;
+ case 2:
+ echo "Trapper";
+ break;
+ case 3:
+ echo "Not supported";
+ break;
+ default:
+ echo "<B>$status</B> Unknown";
+ }
}
echo "</td>";
- if(isset($hostid_))
- {
- echo "<TD><A HREF=\"items.html?hostid=$hostid_&itemid=$itemid_#form\">Change</A></TD>";
- }
- else
- {
- echo "<TD><A HREF=\"items.html?itemid=$itemid_#form\">Change</A></TD>";
- }
+ echo "<TD><A HREF=\"items.html?itemid=".$row["itemid"]."#form\">Change</A></TD>";
echo "</TR>";
}
echo "</TABLE>";
diff --git a/frontends/php/latest.html b/frontends/php/latest.html
index 086bf8af..22414d78 100644
--- a/frontends/php/latest.html
+++ b/frontends/php/latest.html
@@ -56,9 +56,22 @@
cr();
echo "<TR BGCOLOR=\"CCCCCC\">";
cr();
- echo "<TD><B>Description</B></TD>";
- cr();
- echo "<TD WIDTH=\"10%\" NOSAVE><B>Last check</B></TD>";
+ if(!isset($sort)||(isset($sort)&&($sort=="description")))
+ {
+ echo "<TD><B>DESCRIPTION</B></TD>";
+ }
+ else
+ {
+ echo "<TD><B><a href=\"latest.html?hostid=$hostid&sort=description\">Description</B></TD>";
+ }
+ if(isset($sort)&&($sort=="lastcheck"))
+ {
+ echo "<TD WIDTH=\"10%\"><B>LAST CHECK</B></TD>";
+ }
+ else
+ {
+ echo "<TD WIDTH=\"10%\"><B><a href=\"latest.html?hostid=$hostid&sort=lastcheck\">Last check</B></TD>";
+ }
cr();
echo "<TD WIDTH=\"10%\" NOSAVE><B>Last value</B></TD>";
cr();
@@ -71,77 +84,80 @@
echo "</TR>";
cr();
-
$col=0;
- $result=DBselect("select h.host,i.itemid,i.description,i.lastvalue,i.prevvalue,i.lastclock,i.status,h.hostid from items i,hosts h where h.hostid=i.hostid and h.status in (0,2) and h.hostid=$hostid order by h.host,i.description");
- for($i=0;$i<DBnum_rows($result);$i++)
+ if(isset($sort))
{
- $host=DBget_field($result,$i,0);
- $itemid=DBget_field($result,$i,1);
- $hostid=DBget_field($result,$i,7);
-
-
- if($col==1)
+ switch ($sort)
{
- echo "<tr bgcolor=#DDDDDD>";
- $col=0;
- } else
- {
- echo "<tr bgcolor=#EEEEEE>";
- $col=1;
+ case "description":
+ $sort="order by i.description";
+ break;
+ case "lastcheck":
+ $sort="order by i.lastclock";
+ break;
+ default:
+ $sort="order by i.description";
+ break;
}
- $prevvalue=DBget_field($result,$i,4);
- $description=DBget_field($result,$i,2);
- $lastvalue=DBget_field($result,$i,3);
- $lastclock=DBget_field($result,$i,5);
- if($lastclock==NULL)
+ }
+ else
+ {
+ $sort="";
+ }
+ $result=DBselect("select h.host,i.itemid,i.description,i.lastvalue,i.prevvalue,i.lastclock,i.status,h.hostid from items i,hosts h where h.hostid=i.hostid and h.status in (0,2) and h.hostid=$hostid $sort");
+ while($row=DBfetch($result))
+ {
+ if($col++%2 == 1) { echo "<tr bgcolor=#DDDDDD>"; }
+ else { echo "<tr bgcolor=#EEEEEE>"; }
+
+ echo "<td>".$row["description"]."</td>";
+
+ echo "<td>";
+ if($row["status"] == 2)
{
- $lastclock="<center>-</center>";
+ echo "<font color=\"#FF6666\">";
}
- else
+ elseif($row["status"] != 0)
{
- $lastclock=date("H:i:s",$lastclock);
+ echo "<font color=\"#666666\">";
}
- $itemid=DBget_field($result,$i,1);
- $status=DBget_field($result,$i,6);
- $dif=$lastvalue-$prevvalue;
- echo "<td>$description</td>";
- echo "<td>";
- if($status==2)
+
+ if(!isset($row["lastclock"]))
{
- echo "<font color=\"#FF6666\">";
+ echo "<center>-</center>";
}
- elseif($status!=0)
+ else
{
- echo "<font color=\"#666666\">";
+ echo date("d M H:i:s",$row["lastclock"]);
+// echo date("H:i:s",$row["lastclock"]);
}
-
- echo "$lastclock</td>\n";
- if($lastvalue!=NULL)
+ echo "</font></td>";
+
+ if(isset($row["lastvalue"]))
{
- if(round($lastvalue)==$lastvalue)
+ if(round($row["lastvalue"])==$row["lastvalue"])
{
- echo "<td>"; printf("%.0f",$lastvalue); echo "</td>";
+ echo "<td>"; printf("%.0f",$row["lastvalue"]); echo "</td>";
}
else
{
- echo "<td>"; printf("%.2f",$lastvalue); echo "</td>";
+ echo "<td>"; printf("%.2f",$row["lastvalue"]); echo "</td>";
}
}
else
{
- echo "<td><center>-</center></td>";
+ echo "<td><center>-</center></td>";
}
- if( $dif != 0 )
+ if( isset($row["lastvalue"]) && isset($row["prevvalue"]) && $row["lastvalue"]-$row["prevvalue"] != 0 )
{
- echo "<td>$dif</td>";
+ echo "<td>".($row["lastvalue"]-$row["prevvalue"])."</td>";
}
else
{
echo "<td><center>-</center></td>";
}
- echo "<td><center><a href=\"history.html?action=showhistory&itemid=$itemid\">Show</a></center></td>";
- echo "<td><center><a href=\"trends.html?itemid=$itemid\">Show</a></center></td>";
+ echo "<td><center><a href=\"history.html?action=showhistory&itemid=".$row["itemid"]."\">Show</a></center></td>";
+ echo "<td><center><a href=\"trends.html?itemid=".$row["itemid"]."\">Show</a></center></td>";
echo "</tr>";
}
echo "</table>";
diff --git a/frontends/php/report2.html b/frontends/php/report2.html
index 18806ae1..5a050486 100644
--- a/frontends/php/report2.html
+++ b/frontends/php/report2.html
@@ -30,17 +30,15 @@
$lasthost="";
$col=0;
- for($i=0;$i<DBnum_rows($result);$i++)
+ while($row=DBfetch($result))
{
- $hostid_=DBget_field($result,$i,0);
- $host=DBget_field($result,$i,1);
- if($lasthost!=$host)
+ if($lasthost!=$row["host"])
{
if($lasthost!="")
{
echo "</TABLE><BR>";
}
- show_table_header("$host");
+ show_table_header($row["host"]);
echo "<TABLE BORDER=0 COLS=3 WIDTH=\"100%\" BGCOLOR=\"#CCCCCC\" cellspacing=1 cellpadding=3>";
echo "<TR>";
echo "<TD><B>Description</B></TD>";
@@ -49,26 +47,16 @@
echo "<TD WIDTH=\"5%\"><B>False (%)</B></TD>";
echo "</TR>\n";
}
- $lasthost=$host;
+ $lasthost=$row["host"];
- if($col==1)
- {
- echo "<TR BGCOLOR=#DDDDDD>";
- $col=0;
- } else
- {
- echo "<TR BGCOLOR=#EEEEEE>";
- $col=1;
- }
- $description=DBget_field($result,$i,4);
- $triggerid_=DBget_field($result,$i,2);
- $expression=DBget_field($result,$i,3);
- $istrue=DBget_field($result,$i,5);
- echo "<TD>$description</TD>";
- $description=rawurlencode($description);
+ if($col++%2 == 1) { echo "<TR BGCOLOR=#DDDDDD>"; }
+ else { echo "<TR BGCOLOR=#EEEEEE>"; }
- echo "<TD>".explode_exp($expression,1)."</TD>";
- $availability=calculate_availability($triggerid_);
+ echo "<TD>".$row["description"]."</TD>";
+ $description=rawurlencode($row["description"]);
+
+ echo "<TD>".explode_exp($row["expression"],1)."</TD>";
+ $availability=calculate_availability($row["triggerid"]);
echo "<TD>";
printf("%.4f%%",$availability["true"]);
echo "</TD>";
diff --git a/frontends/php/services.html b/frontends/php/services.html
index ecb09cb0..139176e1 100644
--- a/frontends/php/services.html
+++ b/frontends/php/services.html
@@ -16,6 +16,10 @@
}
if($register=="add link")
{
+ if(!isset($softlink))
+ {
+ $softlink=0;
+ }
$result=add_service_link($servicedownid,$serviceupid,$softlink);
show_messages($result,"Service link added","Cannot add service link");
}
@@ -23,7 +27,7 @@
?>
<?
- show_table_header("IT's SERVICES");
+ show_table_header("IT SERVICES");
echo "<br>";
@@ -65,13 +69,14 @@
if($col++%2==0) { echo "<tr bgcolor=#EEEEEE>"; }
else { echo "<tr bgcolor=#DDDDDD>"; }
}
+ $childs=get_num_of_service_childs($row["serviceid"]);
if(isset($serviceid))
{
echo "<td><a href=\"services.html?serviceid=".$row["serviceid"]."#form\"> - ".$row["name"]."</a></td>";
}
else
- echo "<td><a href=\"services.html?serviceid=".$row["serviceid"]."#form\">".$row["name"]."</a></td>";
{
+ echo "<td><a href=\"services.html?serviceid=".$row["serviceid"]."#form\">[$childs] ".$row["name"]."</a></td>";
}
echo "</tr>";
}
@@ -169,17 +174,17 @@
if(isset($serviceid))
{
echo "<input name=\"serviceid\" type=\"hidden\" value=$serviceid>";
- echo "<input name=\"servicedownid\" type=\"hidden\" value=$serviceid>";
+ echo "<input name=\"serviceupid\" type=\"hidden\" value=$serviceid>";
}
echo "Name";
show_table2_h_delimiter();
$result=DBselect("select serviceid,triggerid,name from services order by name");
- echo "<select name=\"serviceupid\" size=1>";
+ echo "<select name=\"servicedownid\" size=1>";
for($i=0;$i<DBnum_rows($result);$i++)
{
- $serviceupid_=DBget_field($result,$i,0);
+ $servicedownid_=DBget_field($result,$i,0);
$name_=DBget_field($result,$i,2);
- echo "<OPTION VALUE='$serviceupid_'>$name_";
+ echo "<OPTION VALUE='$servicedownid_'>$name_";
}
echo "</SELECT>";
diff --git a/frontends/php/srv_status.html b/frontends/php/srv_status.html
index b0b17a7e..c28d7b45 100644
--- a/frontends/php/srv_status.html
+++ b/frontends/php/srv_status.html
@@ -7,7 +7,7 @@
?>
<?
- show_table_header("IT's SERVICES");
+ show_table_header("IT SERVICES");
echo "<br>";
@@ -21,8 +21,24 @@
echo "<tr><td><b>Service</b></td></tr>";
echo "\n";
$col=0;
+ if(isset($serviceid))
+ {
+ echo "<tr bgcolor=#EEEEEE>";
+ $service=get_service_by_serviceid($serviceid);
+ echo "<td><b><a href=\"srv_status.html?serviceid=".$service["serviceid"]."\">".$service["name"]."</a></b></td>";
+ echo "</tr>";
+ $col++;
+ }
while($row=DBfetch($result))
{
+ if(!isset($serviceid) && service_has_parent($row["serviceid"]))
+ {
+ continue;
+ }
+ if(isset($serviceid) && service_has_no_this_parent($serviceid,$row["serviceid"]))
+ {
+ continue;
+ }
if(isset($serviceid)&&($serviceid==$row["serviceid"]))
{
echo "<tr bgcolor=#99AABB>";
@@ -32,7 +48,30 @@
if($col++%2==0) { echo "<tr bgcolor=#EEEEEE>"; }
else { echo "<tr bgcolor=#DDDDDD>"; }
}
- echo "<td><a href=\"srv_status.html?serviceid=".$row["serviceid"]."\">".$row["name"]."</a></td>";
+// echo "<td><a href=\"srv_status.html?serviceid=".$row["serviceid"]."\">".$row["name"]."</a></td>";
+ $childs=get_num_of_service_childs($row["serviceid"]);
+ if(isset($serviceid))
+ {
+ if($childs == 0)
+ {
+ echo "<td> - ".$row["name"]."</td>";
+ }
+ else
+ {
+ echo "<td><a href=\"srv_status.html?serviceid=".$row["serviceid"]."\"> - [$childs]".$row["name"]."</a></td>";
+ }
+ }
+ else
+ {
+ if($childs == 0)
+ {
+ echo "<td>".$row["name"]."</td>";
+ }
+ else
+ {
+ echo "<td><a href=\"srv_status.html?serviceid=".$row["serviceid"]."\">[$childs] ".$row["name"]."</a></td>";
+ }
+ }
echo "</tr>";
}
echo "</table>";
diff --git a/frontends/php/tr_status.html b/frontends/php/tr_status.html
index fd97017b..6a68b11f 100644
--- a/frontends/php/tr_status.html
+++ b/frontends/php/tr_status.html
@@ -37,6 +37,10 @@
<?
+ if(!isset($sort))
+ {
+ $sort='priority';
+ }
if(!isset($onlytrue))
{
$onlytrue='false';
@@ -71,21 +75,21 @@
$result=DBselect("select hostid,host from hosts where status in (0,2) order by host");
if(isset($hostid))
{
- echo "<A HREF=\"tr_status.html?onlytrue=$onlytrue&noactions=$noactions&compact=$compact\">all</A> ";
+ echo "<A HREF=\"tr_status.html?onlytrue=$onlytrue&noactions=$noactions&compact=$compact&sort=$sort\">all</A> ";
}
else
{
- echo "<b>[<A HREF=\"tr_status.html?onlytrue=$onlytrue&noactions=$noactions&compact=$compact\">all</A>]</b> ";
+ echo "<b>[<A HREF=\"tr_status.html?onlytrue=$onlytrue&noactions=$noactions&compact=$compact&sort=$sort\">all</A>]</b> ";
}
while($row=DBfetch($result))
{
if(isset($hostid) && ($row["hostid"] == $hostid))
{
- echo "<b>[<A HREF=\"tr_status.html?hostid=".$row["hostid"]."&onlytrue=$onlytrue&noactions=$noactions&compact=$compact\">".$row["host"]."</A>]</b> ";
+ echo "<b>[<A HREF=\"tr_status.html?hostid=".$row["hostid"]."&onlytrue=$onlytrue&noactions=$noactions&compact=$compact&sort=$sort\">".$row["host"]."</A>]</b> ";
}
else
{
- echo "<A HREF=\"tr_status.html?hostid=".$row["hostid"]."&onlytrue=$onlytrue&noactions=$noactions&compact=$compact\">".$row["host"]."</A> ";
+ echo "<A HREF=\"tr_status.html?hostid=".$row["hostid"]."&onlytrue=$onlytrue&noactions=$noactions&compact=$compact&sort=$sort\">".$row["host"]."</A> ";
}
}
@@ -104,36 +108,36 @@
if($onlytrue!='true')
{
- echo "[<A HREF=\"tr_status.html?onlytrue=true&noactions=$noactions&compact=$compact&select=$select&txt_select=$txt_select$cond\">Show only true</a>] ";
+ echo "[<A HREF=\"tr_status.html?onlytrue=true&noactions=$noactions&compact=$compact&select=$select&txt_select=$txt_select&sort=$sort$cond\">Show only true</a>] ";
}
else
{
- echo "[<A HREF=\"tr_status.html?noactions=$noactions&compact=$compact&select=$select&txt_select=$txt_select$cond\">Show all triggers</A>] ";
+ echo "[<A HREF=\"tr_status.html?noactions=$noactions&compact=$compact&select=$select&txt_select=$txt_select&sort=$sort$cond\">Show all triggers</A>] ";
}
if($noactions!='true')
{
- echo "[<A HREF=\"tr_status.html?onlytrue=$onlytrue&noactions=true&compact=$compact&select=$select&txt_select=$txt_select$cond\">Hide Actions</A>] ";
+ echo "[<A HREF=\"tr_status.html?onlytrue=$onlytrue&noactions=true&compact=$compact&select=$select&txt_select=$txt_select&sort=$sort$cond\">Hide Actions</A>] ";
}
else
{
- echo "[<A HREF=\"tr_status.html?onlytrue=$onlytrue&noactions=false&compact=$compact&select=$select&txt_select=$txt_select$cond\">Show Actions</A>] ";
+ echo "[<A HREF=\"tr_status.html?onlytrue=$onlytrue&noactions=false&compact=$compact&select=$select&txt_select=$txt_select&sort=$sort$cond\">Show Actions</A>] ";
}
if($compact!='true')
{
- echo "[<A HREF=\"tr_status.html?onlytrue=$onlytrue&noactions=$noactions&compact=true&select=$select&txt_select=$txt_select$cond\">Hide Details</A>] ";
+ echo "[<A HREF=\"tr_status.html?onlytrue=$onlytrue&noactions=$noactions&compact=true&select=$select&txt_select=$txt_select&sort=$sort$cond\">Hide Details</A>] ";
}
else
{
- echo "[<A HREF=\"tr_status.html?onlytrue=$onlytrue&noactions=$noactions&compact=false&select=$select&txt_select=$txt_select$cond\">Show Details</A>] ";
+ echo "[<A HREF=\"tr_status.html?onlytrue=$onlytrue&noactions=$noactions&compact=false&select=$select&txt_select=$txt_select&sort=$sort$cond\">Show Details</A>] ";
}
if($select!='true')
{
- echo "[<A HREF=\"tr_status.html?onlytrue=$onlytrue&noactions=$noactions&compact=$compact&select=true&txt_select=$txt_select$cond\">Select</A>] ";
+ echo "[<A HREF=\"tr_status.html?onlytrue=$onlytrue&noactions=$noactions&compact=$compact&select=true&txt_select=$txt_select&sort=$sort$cond\">Select</A>] ";
}
else
{
- echo "[<A HREF=\"tr_status.html?onlytrue=$onlytrue&noactions=$noactions&compact=$compact&select=false$cond\">Hide Select</A>] ";
+ echo "[<A HREF=\"tr_status.html?onlytrue=$onlytrue&noactions=$noactions&compact=$compact&select=false&sort=$sort$cond\">Hide Select</A>] ";
show_table_v_delimiter();
echo "<form name=\"form1\" method=\"get\" action=\"tr_status.html?select=true\">
<input type=\"text\" name=\"txt_select\" value=\"$txt_select\">
@@ -152,7 +156,7 @@
$time=date("[H:i:s]",time());
if(isset($fullscreen))
{
- show_table_header("<A HREF=\"tr_status.html?onlytrue=$onlytrue&noactions=$noactions&compact=$compact\">TRIGGERS $time</A>");
+ show_table_header("<A HREF=\"tr_status.html?onlytrue=$onlytrue&noactions=$noactions&compact=$compact&sort=$sort\">TRIGGERS $time</A>");
$cond="";
if(isset($hostid))
@@ -192,22 +196,54 @@
}
else
{
- show_table_header("<A HREF=\"tr_status.html?onlytrue=$onlytrue&noactions=$noactions&compact=$compact&fullscreen=1\">TRIGGERS $time</A>");
+ show_table_header("<A HREF=\"tr_status.html?onlytrue=$onlytrue&noactions=$noactions&compact=$compact&fullscreen=1&sort=$sort\">TRIGGERS $time</A>");
}
- echo "\n<TABLE BORDER=0 COLS=5 WIDTH=\"100%\" BGCOLOR=\"#CCCCCC\" cellspacing=1 cellpadding=3>";
+ echo "<TABLE BORDER=0 COLS=5 WIDTH=\"100%\" BGCOLOR=\"#CCCCCC\" cellspacing=1 cellpadding=3>";
+
echo "<TR ALIGN=CENTER>";
- echo "<TD ALIGN=LEFT><B>Description";
+ if(isset($fullscreen))
+ {
+ $fullscreen="&fullscreen=1";
+ }
+ else
+ {
+ $fullscreen="";
+ }
+ if(isset($sort) && $sort=="description")
+ {
+ echo "<TD ALIGN=LEFT><B>DESCRIPTION";
+ }
+ else
+ {
+ echo "<TD ALIGN=LEFT><B><A HREF=\"tr_status.html?sort=description&onlytrue=$onlytrue&noactions=$noactions&compact=$compact&select=$select&txt_select=$txt_select$fullscreen$cond\">Description</a>";
+ }
if($compact!='true') {echo "<BR><FONT SIZE=-1>Expression</FONT></B>";}
echo "</TD>";
+
echo "<TD WIDTH=\"5%\"><B>Status</B></TD>";
- echo "<TD WIDTH=\"9%\"><B>Priority</B></TD>";
+
+ if(!isset($sort)||(isset($sort) && $sort=="priority"))
+ {
+ echo "<TD WIDTH=\"9%\" ALIGN=CENTER><B>PRIORITY</B></TD>";
+ }
+ else
+ {
+ echo "<TD ALIGN=CENTER><B><A HREF=\"tr_status.html?sort=priority&onlytrue=$onlytrue&noactions=$noactions&compact=$compact&select=$select&txt_select=$txt_select$fullscreen$cond\">Priority</a>";
+ }
if($noactions=='true')
- echo "<TD WIDTH=\"12%\">";
+ echo "<TD WIDTH=\"12%\" ALIGN=CENTER>";
else
- echo "<TD WIDTH=\"5%\">";
+ echo "<TD WIDTH=\"5%\" ALIGN=CENTER>";
- echo "<B>Last change";
+ if(isset($sort) && $sort=="lastchange")
+ {
+ echo "<B>LAST CHANGE";
+ }
+ else
+ {
+ echo "<B><A HREF=\"tr_status.html?sort=lastchange&onlytrue=$onlytrue&noactions=$noactions&compact=$compact&select=$select&txt_select=$txt_select$fullscreen$cond\">Last change</a>";
+ }
echo "</TD>";
if($noactions!='true')
@@ -226,23 +262,41 @@
$cond="";
}
+ if(!isset($sort))
+ {
+ $sort="priority";
+ }
+
+ switch ($sort)
+ {
+ case "description":
+ $sort="order by t.description";
+ break;
+ case "priority":
+ $sort="order by t.priority desc, t.description";
+ break;
+ case "lastchange":
+ $sort="order by t.lastchange desc, t.priority";
+ break;
+ default:
+ $sort="order by t.priority desc, t.description";
+ }
if($onlytrue=='true')
{
- $result=DBselect("select distinct t.triggerid,t.istrue,t.description,t.expression,t.priority,t.lastchange,t.comments from triggers t,hosts h,items i,functions f where t.istrue=1 and f.itemid=i.itemid and h.hostid=i.hostid and t.description like \"%$txt_select%\" and t.triggerid=f.triggerid and i.status in (0,2) $cond order by t.priority desc, t.description");
+ $result=DBselect("select distinct t.triggerid,t.istrue,t.description,t.expression,t.priority,t.lastchange,t.comments from triggers t,hosts h,items i,functions f where t.istrue=1 and f.itemid=i.itemid and h.hostid=i.hostid and t.description like \"%$txt_select%\" and t.triggerid=f.triggerid and i.status in (0,2) $cond $sort");
}
else
{
- $result=DBselect("select distinct t.triggerid,t.istrue,t.description,t.expression,t.priority,t.lastchange,t.comments from triggers t,hosts h,items i,functions f where f.itemid=i.itemid and h.hostid=i.hostid and t.triggerid=f.triggerid and t.description like \"%$txt_select%\" and i.status in (0,2) $cond order by t.priority desc, t.description");
+ $result=DBselect("select distinct t.triggerid,t.istrue,t.description,t.expression,t.priority,t.lastchange,t.comments from triggers t,hosts h,items i,functions f where f.itemid=i.itemid and h.hostid=i.hostid and t.triggerid=f.triggerid and t.description like \"%$txt_select%\" and i.status in (0,2) $cond $sort");
}
$col=0;
- for($i=0;$i<DBnum_rows($result);$i++)
+ while($row=DBfetch($result))
{
- $triggerid=DBget_field($result,$i,0);
// Check for dependencies
- $sql="select count(*) from trigger_depends d, triggers t where d.triggerid_down=$triggerid and d.triggerid_up=t.triggerid and t.istrue=1";
+ $sql="select count(*) from trigger_depends d, triggers t where d.triggerid_down=".$row["triggerid"]." and d.triggerid_up=t.triggerid and t.istrue=1";
$result2=DBselect($sql);
if(DBget_field($result2,0,0)>0)
@@ -251,78 +305,62 @@
}
- if($col==1)
- {
- echo "\n<TR BGCOLOR=#EEEEEE>";
- $col=0;
- } else
- {
- echo "\n<TR BGCOLOR=#DDDDDD>";
- $col=1;
- }
- $expression=DBget_field($result,$i,3);
- $description=DBget_field($result,$i,2);
- $istrue=DBget_field($result,$i,1);
- $priority=DBget_field($result,$i,4);
- $lastchange=DBget_field($result,$i,5);
- $comments=DBget_field($result,$i,6);
-
- $lastchange=date("d M H:i:s",$lastchange);
+ if($col++%2 == 1) { echo "<TR BGCOLOR=#EEEEEE>"; }
+ else { echo "<TR BGCOLOR=#DDDDDD>"; }
echo "<TD>";
- echo "$description";
+ echo $row["description"];
if($compact!='true')
{
- $expression=explode_exp($expression,1);
- echo "<BR><FONT COLOR=\"#000000\" SIZE=-2>$expression</FONT>";
+ echo "<BR><FONT COLOR=\"#000000\" SIZE=-2>".explode_exp($row["expression"],1)."</FONT>";
}
echo "</TD>";
- if($istrue==0)
- { echo "<TD ALIGN=CENTER><FONT COLOR=\"00AA00\">FALSE</FONT></TD>";}
- elseif($istrue==2)
- { echo "<TD ALIGN=CENTER><FONT COLOR=\"777777\">DISABLED</FONT></TD>"; }
+ if($row["istrue"]==0)
+ { echo "<TD ALIGN=CENTER><FONT COLOR=\"00AA00\">FALSE</FONT></TD>";}
+ elseif($row["istrue"]==2)
+ { echo "<TD ALIGN=CENTER><FONT COLOR=\"777777\">DISABLED</FONT></TD>"; }
else
- { echo "<TD ALIGN=CENTER><FONT COLOR=\"AA0000\">TRUE</FONT></TD>"; }
+ { echo "<TD ALIGN=CENTER><FONT COLOR=\"AA0000\">TRUE</FONT></TD>"; }
- if($priority==0) echo "<TD ALIGN=CENTER>Not classified</TD>";
- elseif($priority==1) echo "<TD ALIGN=CENTER>Just information</TD>";
- elseif($priority==2) echo "<TD ALIGN=CENTER>Warning</TD>";
- elseif($priority==3) echo "<TD ALIGN=CENTER BGCOLOR=#DDAAAA>Average</TD>";
- elseif($priority==4) echo "<TD ALIGN=CENTER BGCOLOR=#FF8888>High</TD>";
- elseif($priority==5) echo "<TD ALIGN=CENTER BGCOLOR=RED>Disaster !!!</TD>";
- else echo "<TD ALIGN=CENTER><B>$priority</B></TD>";
+ if($row["priority"]==0) echo "<TD ALIGN=CENTER>Not classified</TD>";
+ elseif($row["priority"]==1) echo "<TD ALIGN=CENTER>Just information</TD>";
+ elseif($row["priority"]==2) echo "<TD ALIGN=CENTER>Warning</TD>";
+ elseif($row["priority"]==3) echo "<TD ALIGN=CENTER BGCOLOR=#DDAAAA>Average</TD>";
+ elseif($row["priority"]==4) echo "<TD ALIGN=CENTER BGCOLOR=#FF8888>High</TD>";
+ elseif($row["priority"]==5) echo "<TD ALIGN=CENTER BGCOLOR=RED>Disaster !!!</TD>";
+ else echo "<TD ALIGN=CENTER><B>".$row["priority"]."</B></TD>";
- echo "<TD ALIGN=CENTER><A HREF=\"alarms.html?triggerid=$triggerid\">$lastchange</a>";
+ echo "<TD ALIGN=CENTER><A HREF=\"alarms.html?triggerid=".$row["triggerid"]."\">".date("d M H:i:s",$row["lastchange"])."</a>";
echo "</TD>";
if($noactions!='true')
{
echo "<TD>";
- echo "<A HREF=\"actions.html?triggerid=$triggerid\">Show actions</A> - ";
- echo "<A HREF=\"alarms.html?triggerid=$triggerid\">History</A> - ";
+ echo "<A HREF=\"actions.html?triggerid=".$row["triggerid"]."\">Show actions</A> - ";
+ echo "<A HREF=\"alarms.html?triggerid=".$row["triggerid"]."\">History</A> - ";
if(isset($hostid))
{
- echo "<A HREF=\"triggers.html?hostid=$hostid&triggerid=$triggerid#form\">Change</A>";
+ echo "<A HREF=\"triggers.html?hostid=$hostid&triggerid=".$row["triggerid"]."#form\">Change</A>";
}
else
{
- echo "<A HREF=\"triggers.html?triggerid=$triggerid#form\">Change</A>";
+ echo "<A HREF=\"triggers.html?triggerid=".$row["triggerid"]."#form\">Change</A>";
}
echo "</TD>";
}
- if($comments!="")
+ if($row["comments"] != "")
{
- echo "<TD ALIGN=CENTER><A HREF=\"tr_comments.html?triggerid=$triggerid\">Show</a></TD>";
+ echo "<TD ALIGN=CENTER><A HREF=\"tr_comments.html?triggerid=".$row["triggerid"]."\">Show</a></TD>";
}
else
{
- echo "<TD ALIGN=CENTER><A HREF=\"edit_comments.html?triggerid=$triggerid\">Add</a></TD>";
+ echo "<TD ALIGN=CENTER><A HREF=\"tr_comments.html?triggerid=".$row["triggerid"]."\">Add</a></TD>";
}
- if($istrue==0) echo "</TR>\n";
+ if($row["istrue"] == 0) echo "</TR>\n";
}
- echo "</TABLE>\n";
+ echo "</TABLE>";
$i=DBnum_rows($result);
diff --git a/frontends/php/triggers.html b/frontends/php/triggers.html
index 4c3d263d..9432b33f 100644
--- a/frontends/php/triggers.html
+++ b/frontends/php/triggers.html
@@ -75,22 +75,19 @@
<?
$result=DBselect("select hostid,host from hosts order by host");
- for($i=0;$i<DBnum_rows($result);$i++)
+ while($row=DBfetch($result))
{
- $hid=DBget_field($result,$i,0);
- $host=DBget_field($result,$i,1);
- if(isset($hostid) && ($hid == $hostid))
+ if(isset($hostid) && ($row["hostid"] == $hostid))
{
- echo "<b>[<A HREF=\"triggers.html?hostid=$hid\">$host</A>]</b> ";
+ echo "<b>[<A HREF=\"triggers.html?hostid=".$row["hostid"]."\">".$row["host"]."</A>]</b> ";
}
else
{
- echo "<A HREF=\"triggers.html?hostid=$hid\">$host</A> ";
+ echo "<A HREF=\"triggers.html?hostid=".$row["hostid"]."\">".$row["host"]."</A> ";
}
}
show_table_header_end();
- echo "<br>";
?>
<?
@@ -101,17 +98,16 @@
$result=DBselect("select distinct h.hostid,h.host,t.triggerid,t.expression,t.description,t.istrue from triggers t,hosts h,items i,functions f where f.itemid=i.itemid and h.hostid=i.hostid and t.triggerid=f.triggerid and h.hostid=$hostid order by h.host,t.description");
$lasthost="";
$col=0;
- for($i=0;$i<DBnum_rows($result);$i++)
+ while($row=DBfetch($result))
{
- $hostid_=DBget_field($result,$i,0);
- $host=DBget_field($result,$i,1);
- if($lasthost!=$host)
+ if($lasthost!=$row["host"])
{
if($lasthost!="")
{
echo "</TABLE><BR>";
}
- show_table_header("<A HREF='triggers.html?hostid=$hostid_'>$host</A>");
+ echo "<br>";
+ show_table_header("<A HREF='triggers.html?hostid=".$row["hostid"]."'>".$row["host"]."</A>");
echo "<TABLE BORDER=0 COLS=3 WIDTH=\"100%\" BGCOLOR=\"#CCCCCC\" cellspacing=1 cellpadding=3>";
echo "<TR>";
echo "<TD><B>Description</B></TD>";
@@ -120,46 +116,36 @@
echo "<TD WIDTH=\"15%\" NOSAVE><B>Actions</B></TD>";
echo "</TR>\n";
}
- $lasthost=$host;
+ $lasthost=$row["host"];
- if($col==1)
- {
- echo "<TR BGCOLOR=#DDDDDD>";
- $col=0;
- } else
- {
- echo "<TR BGCOLOR=#EEEEEE>";
- $col=1;
- }
- $triggerid_=DBget_field($result,$i,2);
- $expression=DBget_field($result,$i,3);
- $description=DBget_field($result,$i,4);
- $istrue=DBget_field($result,$i,5);
- echo "<TD>$description</TD>";
- $description=rawurlencode($description);
+ if($col++%2 == 1) { echo "<TR BGCOLOR=#DDDDDD>"; }
+ else { echo "<TR BGCOLOR=#EEEEEE>"; }
+
+ echo "<TD>".$row["description"]."</TD>";
- echo "<TD>".explode_exp($expression,1)."</TD>";
+ echo "<TD>".explode_exp($row["expression"],1)."</TD>";
echo "<TD>";
- if($istrue == 2)
+ if($row["istrue"] == 2)
{
- echo "<a href=\"triggers.html?register=changestatus&triggerid=$triggerid_&status=0&hostid=$hostid_\">Disabled";
+ echo "<a href=\"triggers.html?register=changestatus&triggerid=".$row["triggerid"]."&status=0&hostid=".$row["hostid"]."\">Disabled</a>";
}
else
{
- echo "<a href=\"triggers.html?register=changestatus&triggerid=$triggerid_&status=2&hostid=$hostid_\">Enabled";
+ echo "<a href=\"triggers.html?register=changestatus&triggerid=".$row["triggerid"]."&status=2&hostid=".$row["hostid"]."\">Enabled</a>";
}
- $expression=rawurlencode($expression);
+ $expression=rawurlencode($row["expression"]);
echo "</TD>";
echo "<TD>";
if(isset($hostid))
{
- echo "<A HREF=\"triggers.html?triggerid=$triggerid_&hostid=$hostid#form\">Change</A> ";
+ echo "<A HREF=\"triggers.html?triggerid=".$row["triggerid"]."&hostid=".$row["hostid"]."#form\">Change</A> ";
}
else
{
- echo "<A HREF=\"triggers.html?triggerid=$triggerid_#form\">Change</A> ";
+ echo "<A HREF=\"triggers.html?triggerid=".$row["triggerid"]."#form\">Change</A> ";
}
- echo "-<A HREF=\"actions.html?triggerid=$triggerid_&description=$description\">ShowActions</A>";
+// echo "-<A HREF=\"actions.html?triggerid=".$row["triggerid"]."&description=".$row["description"]."\">ShowActions</A>";
+ echo "-<A HREF=\"actions.html?triggerid=".$row["triggerid"]."\">ShowActions</A>";
echo "</TD>";
echo "</TR>\n";
}