diff options
author | hugetoad <hugetoad@97f52cf1-0a1b-0410-bd0e-c28be96e8082> | 2001-04-16 17:45:23 +0000 |
---|---|---|
committer | hugetoad <hugetoad@97f52cf1-0a1b-0410-bd0e-c28be96e8082> | 2001-04-16 17:45:23 +0000 |
commit | a2f46eff39e547e40d042ce97851805b9f9efea4 (patch) | |
tree | 674ce1bfe3af9dd6ca058b44d5d0fdf9e7b4ba29 /frontends/php/tr_status.html | |
parent | a23282b7b988f6bbe5e7f98170c88e0dfe24fc3b (diff) | |
download | zabbix-a2f46eff39e547e40d042ce97851805b9f9efea4.tar.gz zabbix-a2f46eff39e547e40d042ce97851805b9f9efea4.tar.xz zabbix-a2f46eff39e547e40d042ce97851805b9f9efea4.zip |
Added PostgreSQL support for PHP frontend. Added database abstraction layer in frontend/php/include/db.inc.
git-svn-id: svn://svn.zabbix.com/trunk@42 97f52cf1-0a1b-0410-bd0e-c28be96e8082
Diffstat (limited to 'frontends/php/tr_status.html')
-rw-r--r-- | frontends/php/tr_status.html | 47 |
1 files changed, 22 insertions, 25 deletions
diff --git a/frontends/php/tr_status.html b/frontends/php/tr_status.html index 0489ac25..8d5fc6c3 100644 --- a/frontends/php/tr_status.html +++ b/frontends/php/tr_status.html @@ -15,7 +15,7 @@ ?> <? - $result=mysql_query("select hostid,host from hosts order by host",$mysql); + $result=DBselect("select hostid,host from hosts order by host"); if(isset($hostid)) { echo "<A HREF=\"tr_status.html\">all</A> "; @@ -24,10 +24,10 @@ { echo "<b>[<A HREF=\"tr_status.html\">all</A>]</b> "; } - while($row=mysql_fetch_row($result)) + for($i=0;$i<DBnum_rows($result);$i++) { - $hid=$row[0]; - $host=$row[1]; + $hid=DBget_field($result,$i,0); + $host=DBget_field($result,$i,1); if($hid == $hostid) { echo "<b>[<A HREF=\"tr_status.html?hostid=$hid\">$host</A>]</b> "; @@ -116,17 +116,14 @@ if($onlytrue=='true') { - $result=mysql_query("select t.triggerid,t.istrue,t.description,t.lastcheck,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.triggerid=f.triggerid $cond order by t.priority desc, t.description",$mysql); + $result=DBselect("select t.triggerid,t.istrue,t.description,t.lastcheck,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.triggerid=f.triggerid $cond order by t.priority desc, t.description"); } else { - $result=mysql_query("select t.triggerid,t.istrue,t.description,t.lastcheck,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 $cond order by t.priority desc, t.description",$mysql); + $result=DBselect("select t.triggerid,t.istrue,t.description,t.lastcheck,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 $cond order by t.priority desc, t.description"); } - $trigcount=0; - $i=0; - while($row=mysql_fetch_row($result)) + for($i=0;$i<DBnum_rows($result);$i++) { - $trigcount++; if($col==1) { echo "\n<TR BGCOLOR=#EEEEEE>"; @@ -136,14 +133,14 @@ echo "\n<TR BGCOLOR=#DDDDDD>"; $col=1; } - $expression=$row[4]; - $description=$row[2]; - $triggerid=$row[0]; - $istrue=$row[1]; - $lastcheck=$row[3]; - $priority=$row[5]; - $lastchange=$row[6]; - $comments=$row[7]; + $expression=DBget_field($result,$i,4); + $description=DBget_field($result,$i,2); + $triggerid=DBget_field($result,$i,0); + $istrue=DBget_field($result,$i,1); + $lastcheck=DBget_field($result,$i,3); + $priority=DBget_field($result,$i,5); + $lastchange=DBget_field($result,$i,6); + $comments=DBget_field($result,$i,7); $lastchange=date("d M H:i:s",$lastchange); @@ -193,20 +190,20 @@ echo "</TD>"; } if($istrue==0) echo "</TR>\n"; - $i++; } echo "</TABLE>\n"; + $i=DBnum_rows($result); + show_table_header("Total:$i"); - $result=mysql_query(" select min(lastcheck) from triggers where istrue<2;",$mysql); - $row=mysql_fetch_row($result); - $lastcheck=$row[0]; + $result=DBselect("select min(lastcheck) from triggers where istrue<2"); + $lastcheck=DBget_field($result,0,0); $diff=mktime()-$lastcheck; - $result=mysql_query("select count(*) from items i,hosts h where i.status=0 and h.status=0 and h.hostid=i.hostid and i.nextcheck<UNIX_TIMESTAMP()-60;",$mysql); - $row=mysql_fetch_row($result); - $answ=$row[0]; + $now=time(); + $result=DBselect("select count(*) from items i,hosts h where i.status=0 and h.status=0 and h.hostid=i.hostid and i.nextcheck<$now-60"); + $answ=DBget_field($result,0,0); if ($answ>0) { echo "<br>"; |