diff options
author | hugetoad <hugetoad@97f52cf1-0a1b-0410-bd0e-c28be96e8082> | 2002-05-12 18:01:48 +0000 |
---|---|---|
committer | hugetoad <hugetoad@97f52cf1-0a1b-0410-bd0e-c28be96e8082> | 2002-05-12 18:01:48 +0000 |
commit | 4855aae12c151e6473922b2a5d3de5c7bafe9e48 (patch) | |
tree | 7927ac6a64d439030c4c453718b3ece248aa325a /frontends | |
parent | 8ffad73609ee2547a179e11d11f0258a7bc0f0b1 (diff) | |
download | zabbix-4855aae12c151e6473922b2a5d3de5c7bafe9e48.tar.gz zabbix-4855aae12c151e6473922b2a5d3de5c7bafe9e48.tar.xz zabbix-4855aae12c151e6473922b2a5d3de5c7bafe9e48.zip |
- support for new trigger status - UNKNOWN (Alexei)
git-svn-id: svn://svn.zabbix.com/trunk@360 97f52cf1-0a1b-0410-bd0e-c28be96e8082
Diffstat (limited to 'frontends')
-rw-r--r-- | frontends/php/alarms.php | 2 | ||||
-rw-r--r-- | frontends/php/include/config.inc | 63 | ||||
-rw-r--r-- | frontends/php/index.php | 2 | ||||
-rw-r--r-- | frontends/php/latestalarms.php | 4 | ||||
-rw-r--r-- | frontends/php/report2.php | 4 | ||||
-rw-r--r-- | frontends/php/services.php | 37 | ||||
-rw-r--r-- | frontends/php/tr_status.php | 6 | ||||
-rw-r--r-- | frontends/php/triggers.php | 4 |
8 files changed, 106 insertions, 16 deletions
diff --git a/frontends/php/alarms.php b/frontends/php/alarms.php index 181b8e46..22c45818 100644 --- a/frontends/php/alarms.php +++ b/frontends/php/alarms.php @@ -112,7 +112,7 @@ } elseif($row["status"]==3) { - $istrue="MODIFIED"; + $istrue="UNKNOWN"; $dissum=$dissum+$leng; $sum=$dissum; } diff --git a/frontends/php/include/config.inc b/frontends/php/include/config.inc index fc13560c..e2676aa8 100644 --- a/frontends/php/include/config.inc +++ b/frontends/php/include/config.inc @@ -1099,6 +1099,7 @@ where h.hostid=i.hostid and i.itemid=f.itemid and f.triggerid=$triggerid"; function update_trigger_status($triggerid,$status) { + add_alarm($triggerid,3); $sql="update triggers set istrue=$status where triggerid=$triggerid"; return DBexecute($sql); } @@ -1494,6 +1495,22 @@ where h.hostid=i.hostid and i.itemid=f.itemid and f.triggerid=$triggerid"; function add_alarm($triggerid,$istrue) { + $sql="select max(clock) from alarms"; + $result=DBselect($sql); + if(DBnum_rows($result) == 1) + { + $row=DBfetch($result); + $sql="select istrue from alarms where clock=".$row[0]; + $result=DBselect($sql); + if(DBnum_rows($result) == 1) + { + $row=DBfetch($result); + if($row["istrue"] == $istrue) + { + return 0; + } + } + } $now=time(); $sql="insert into alarms(triggerid,clock,istrue) values($triggerid,$now,$istrue)"; return DBexecute($sql); @@ -1505,11 +1522,11 @@ where h.hostid=i.hostid and i.itemid=f.itemid and f.triggerid=$triggerid"; { global $ERROR_MSG; - if(!check_right("Trigger","A",0)) - { - $ERROR_MSG="Insufficient permissions"; - return 0; - } +// if(!check_right("Trigger","A",0)) +// { +// $ERROR_MSG="Insufficient permissions"; +// return 0; +// } $description=addslashes($description); $sql="insert into triggers (description,priority,istrue,comments,url) values ('$description',$priority,$istrue,'$comments','$url')"; @@ -1522,6 +1539,7 @@ where h.hostid=i.hostid and i.itemid=f.itemid and f.triggerid=$triggerid"; $triggerid=DBinsert_id($result,"triggers","triggerid"); # echo $triggerid,"<br>"; + add_alarm($triggerid,3); $expression=implode_exp($expression,$triggerid); $sql="update triggers set expression='$expression' where triggerid=$triggerid"; @@ -1575,7 +1593,14 @@ where h.hostid=i.hostid and i.itemid=f.itemid and f.triggerid=$triggerid"; } $expression=implode_exp($expression,$triggerid); - if($istrue != 2) $istrue="istrue"; + if($istrue != 2) + { + $istrue="istrue"; + } + else + { + add_alarm($triggerid,3); + } $sql="update triggers set expression='$expression',description='$description',priority=$priority,istrue=$istrue,comments='$comments',url='$url' where triggerid=$triggerid"; return DBexecute($sql); } @@ -2612,7 +2637,7 @@ where h.hostid=i.hostid and i.itemid=f.itemid and f.triggerid=$triggerid"; $expression=""; $description=""; $priority=0; - $istrue=0; + $istrue=3; $comments=""; $url=""; } @@ -2817,6 +2842,7 @@ where h.hostid=i.hostid and i.itemid=f.itemid and f.triggerid=$triggerid"; $state=-1; $true_time=0; $false_time=0; + $unknown_time=0; $time=$min; $max=time(); for($i=0;$i<DBnum_rows($result);$i++) @@ -2839,6 +2865,10 @@ where h.hostid=i.hostid and i.itemid=f.itemid and f.triggerid=$triggerid"; { $true_time+=$diff; } + if($state == 3) + { + $unknown_time+=$diff; + } } else if($state==0) { @@ -2850,6 +2880,11 @@ where h.hostid=i.hostid and i.itemid=f.itemid and f.triggerid=$triggerid"; $true_time+=$diff; $state=$istrue; } + else if($state==3) + { + $unknown_time+=$diff; + $state=$istrue; + } } if(DBnum_rows($result)==0) @@ -2862,16 +2897,24 @@ where h.hostid=i.hostid and i.itemid=f.itemid and f.triggerid=$triggerid"; { $false_time=$false_time+$max-$time; } - else + elseif($state==1) { $true_time=$true_time+$max-$time; } + elseif($state==3) + { + $unknown_time=$unknown_time+$max-$time; + } + } + $total_time=$true_time+$false_time+$unknown_time; $ret["true_time"]=$true_time; $ret["false_time"]=$false_time; - $ret["true"]=(100*$true_time)/($true_time+$false_time); - $ret["false"]=(100*$false_time)/($true_time+$false_time); + $ret["unknown_time"]=$unknown_time; + $ret["true"]=(100*$true_time)/$total_time; + $ret["false"]=(100*$false_time)/$total_time; + $ret["unknown"]=(100*$unknown_time)/$total_time; return $ret; } diff --git a/frontends/php/index.php b/frontends/php/index.php index 6e0916e3..b650668e 100644 --- a/frontends/php/index.php +++ b/frontends/php/index.php @@ -11,8 +11,6 @@ echo "<center>"; echo "<font face=\"arial,helvetica\" size=2>"; echo "Connected as ".$USER_DETAILS["alias"]."</b>"; - echo "<br>"; - echo "<a href=\"index.php?reconnect=1\">RECONNECT</a>"; echo "</font>"; echo "</center>"; ?> diff --git a/frontends/php/latestalarms.php b/frontends/php/latestalarms.php index b779d3bc..751ecd2a 100644 --- a/frontends/php/latestalarms.php +++ b/frontends/php/latestalarms.php @@ -66,6 +66,10 @@ { echo "<TD><font color=\"00AA00\">OFF</font></TD>"; } + elseif($row["istrue"] == 3) + { + echo "<TD><font color=\"AAAAAA\">UNKNOWN</font></TD>"; + } else { echo "<TD><font color=\"AA0000\">ON</font></TD>"; diff --git a/frontends/php/report2.php b/frontends/php/report2.php index 5a785633..2a298568 100644 --- a/frontends/php/report2.php +++ b/frontends/php/report2.php @@ -45,6 +45,7 @@ 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"; } $lasthost=$row["host"]; @@ -63,6 +64,9 @@ echo "<TD>"; printf("%.4f%%",$availability["false"]); echo "</TD>"; + echo "<TD>"; + printf("%.4f%%",$availability["unknown"]); + echo "</TD>"; echo "</TR>\n"; } echo "</table>\n"; diff --git a/frontends/php/services.php b/frontends/php/services.php index be2186f3..fe42e786 100644 --- a/frontends/php/services.php +++ b/frontends/php/services.php @@ -105,6 +105,43 @@ <? if(isset($serviceid)) { + show_table_header("LINKS"); + echo "<table border=0 width=100% bgcolor='#CCCCCC' cellspacing=1 cellpadding=3>"; + echo "<tr>"; + echo "<td><b>Service 1</b></td>"; + echo "<td><b>Service 2</b></td>"; + echo "<td><b>Soft/hard link</b></td>"; + echo "<td><b>Actions</b></td>"; + echo "</tr>"; + $sql="select servicedownid,serviceupid,soft from services_links where serviceupid=$serviceid or servicedownid=$serviceid"; + $result=DBselect($sql); + $col=0; + while($row=DBfetch($result)) + { + if($col++%2==0) { echo "<tr bgcolor=#EEEEEE>"; } + else { echo "<tr bgcolor=#DDDDDD>"; } + $service=get_service_by_serviceid($row["serviceupid"]); + echo "<td>".$service["name"]."</td>"; + $service=get_service_by_serviceid($row["servicedownid"]); + echo "<td>".$service["name"]."</td>"; + if($row["soft"] == 0) + { + echo "<td>Hard</td>"; + } + else + { + echo "<td>Soft</td>"; + } + echo "<td><a href=\"services.php?register=delete_link?\">".$service["name"]."</td>"; + echo "</tr>"; + } + echo "</table>"; + } +?> + +<? + if(isset($serviceid)) + { $result=DBselect("select serviceid,triggerid,name from services where serviceid=$serviceid"); $triggerid=DBget_field($result,0,1); $name=DBget_field($result,0,2); diff --git a/frontends/php/tr_status.php b/frontends/php/tr_status.php index 034e1a9f..bbd7a52e 100644 --- a/frontends/php/tr_status.php +++ b/frontends/php/tr_status.php @@ -383,8 +383,12 @@ { 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 + elseif($row["istrue"]==1) { echo "<TD ALIGN=CENTER><FONT COLOR=\"AA0000\">TRUE</FONT></TD>"; } + elseif($row["istrue"]==3) + { echo "<TD ALIGN=CENTER><FONT COLOR=\"AA0000\">UNKNOWN</FONT></TD>"; } + else + { echo "<TD ALIGN=CENTER><FONT COLOR=\"AA0000\">Error !</FONT></TD>"; } if($row["priority"]==0) echo "<TD ALIGN=CENTER>Not classified</TD>"; elseif($row["priority"]==1) echo "<TD ALIGN=CENTER>Just information</TD>"; diff --git a/frontends/php/triggers.php b/frontends/php/triggers.php index a6dbb036..4574ed83 100644 --- a/frontends/php/triggers.php +++ b/frontends/php/triggers.php @@ -58,7 +58,7 @@ if(validate_expression($expression)==0) { if(isset($disabled)) { $istrue=2; } - else { $istrue=0; } + else { $istrue=3; } $result=add_trigger($expression,$description,$priority,$istrue,$comments,$url); show_messages($result,"Trigger added","Cannot add trigger"); @@ -146,7 +146,7 @@ echo "<TD>"; if($row["istrue"] == 2) { - echo "<a href=\"triggers.php?register=changestatus&triggerid=".$row["triggerid"]."&status=0&hostid=".$row["hostid"]."\">Disabled</a>"; + echo "<a href=\"triggers.php?register=changestatus&triggerid=".$row["triggerid"]."&status=3&hostid=".$row["hostid"]."\">Disabled</a>"; } else { |