diff options
| author | hugetoad <hugetoad@97f52cf1-0a1b-0410-bd0e-c28be96e8082> | 2002-07-26 06:29:08 +0000 |
|---|---|---|
| committer | hugetoad <hugetoad@97f52cf1-0a1b-0410-bd0e-c28be96e8082> | 2002-07-26 06:29:08 +0000 |
| commit | a92a8524d8ed82855ea113e50e6894684e87ae9d (patch) | |
| tree | 5c7fb36b8b92f3324641c04c2a2529529fbf5a03 /frontends/php/report2.php | |
| parent | f54cd33a46be956ce776c16bc63e32a4db3d0a7c (diff) | |
| download | zabbix-a92a8524d8ed82855ea113e50e6894684e87ae9d.tar.gz zabbix-a92a8524d8ed82855ea113e50e6894684e87ae9d.tar.xz zabbix-a92a8524d8ed82855ea113e50e6894684e87ae9d.zip | |
Host selection for availability report.
git-svn-id: svn://svn.zabbix.com/trunk@443 97f52cf1-0a1b-0410-bd0e-c28be96e8082
Diffstat (limited to 'frontends/php/report2.php')
| -rw-r--r-- | frontends/php/report2.php | 124 |
1 files changed, 67 insertions, 57 deletions
diff --git a/frontends/php/report2.php b/frontends/php/report2.php index e534f733..6fc653f8 100644 --- a/frontends/php/report2.php +++ b/frontends/php/report2.php @@ -6,80 +6,90 @@ ?> <? - if(!isset($yes)) - { - echo "<center>"; - echo "<a href=\"report2.php?yes=1\">"; - echo "Click here to run report"; - echo "</a>"; - echo "</center>"; - show_footer(); - exit; - } + show_table_header_begin(); + echo "AVAILABILITY REPORT"; -?> + show_table_v_delimiter(); -<? - show_table_header("AVAILABILITY REPORT"); - echo "<br>"; -?> - -<? + echo "<font size=2>"; - $result=DBselect("select distinct h.hostid,h.host,t.triggerid,t.expression,t.description,t.value from triggers t,hosts h,items i,functions f where f.itemid=i.itemid and h.hostid=i.hostid and t.status=0 and t.triggerid=f.triggerid and h.status in (0,2) and i.status=0 order by h.host, t.description"); + $result=DBselect("select h.hostid,h.host from hosts h,items i where h.status in (0,2) and h.hostid=i.hostid group by h.hostid,h.host order by h.host"); - $lasthost=""; - $col=0; while($row=DBfetch($result)) { - if(!check_right_on_trigger("R",$row["triggerid"])) + if(!check_right("Host","R",$row["hostid"])) { continue; } - if($lasthost!=$row["host"]) + if( isset($hostid) && ($hostid == $row["hostid"]) ) { - if($lasthost!="") - { - echo "</TABLE><BR>"; - } - 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>"; - echo "<TD><B>Expression</B></TD>"; - echo "<TD WIDTH=\"5%\"><B>True (%)</B></TD>"; - echo "<TD WIDTH=\"5%\"><B>False (%)</B></TD>"; - echo "<TD WIDTH=\"5%\"><B>Unknown (%)</B></TD>"; - echo "</TR>\n"; + echo "<b>["; } - $lasthost=$row["host"]; + echo "<a href='report2.php?hostid=".$row["hostid"]."'>".$row["host"]."</a>"; + if(isset($hostid) && ($hostid == $row["hostid"]) ) + { + echo "]</b>"; + } + echo " "; + } - if($col++%2 == 1) { echo "<TR BGCOLOR=#DDDDDD>"; } - else { echo "<TR BGCOLOR=#EEEEEE>"; } + echo "</font>"; + show_table_header_end(); +?> - $description=$row["description"]; +<? + if(isset($hostid)) + { + echo "<br>"; + $result=DBselect("select host from hosts where hostid=$hostid"); + $row=DBfetch($result); + show_table_header($row["host"]); - if( strstr($description,"%s")) + $result=DBselect("select distinct h.hostid,h.host,t.triggerid,t.expression,t.description,t.value from triggers t,hosts h,items i,functions f where f.itemid=i.itemid and h.hostid=i.hostid and t.status=0 and t.triggerid=f.triggerid and h.hostid=$hostid and h.status in (0,2) and i.status=0 order by h.host, t.description"); + echo "<TABLE BORDER=0 COLS=3 WIDTH=\"100%\" BGCOLOR=\"#CCCCCC\" cellspacing=1 cellpadding=3>"; + echo "<TR>"; + echo "<TD><B>Description</B></TD>"; + echo "<TD><B>Expression</B></TD>"; + echo "<TD WIDTH=\"5%\"><B>True (%)</B></TD>"; + echo "<TD WIDTH=\"5%\"><B>False (%)</B></TD>"; + echo "<TD WIDTH=\"5%\"><B>Unknown (%)</B></TD>"; + echo "</TR>\n"; + $col=0; + while($row=DBfetch($result)) { - $description=expand_trigger_description($row["triggerid"]); - } - echo "<TD><a href=\"alarms.php?triggerid=".$row["triggerid"]."\">$description</a></TD>"; - $description=rawurlencode($row["description"]); + if(!check_right_on_trigger("R",$row["triggerid"])) + { + continue; + } + $lasthost=$row["host"]; - echo "<TD>".explode_exp($row["expression"],1)."</TD>"; - $availability=calculate_availability($row["triggerid"]); - echo "<TD>"; - printf("%.4f%%",$availability["true"]); - echo "</TD>"; - echo "<TD>"; - printf("%.4f%%",$availability["false"]); - echo "</TD>"; - echo "<TD>"; - printf("%.4f%%",$availability["unknown"]); - echo "</TD>"; - echo "</TR>\n"; + if($col++%2 == 1) { echo "<TR BGCOLOR=#DDDDDD>"; } + else { echo "<TR BGCOLOR=#EEEEEE>"; } + + $description=$row["description"]; + + if( strstr($description,"%s")) + { + $description=expand_trigger_description($row["triggerid"]); + } + echo "<TD><a href=\"alarms.php?triggerid=".$row["triggerid"]."\">$description</a></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>"; + echo "<TD>"; + printf("%.4f%%",$availability["false"]); + echo "</TD>"; + echo "<TD>"; + printf("%.4f%%",$availability["unknown"]); + echo "</TD>"; + echo "</TR>\n"; + } + echo "</table>\n"; } - echo "</table>\n"; ?> <? |
