4
** Copyright (C) 2000-2005 SIA Zabbix
6
** This program is free software; you can redistribute it and/or modify
7
** it under the terms of the GNU General Public License as published by
8
** the Free Software Foundation; either version 2 of the License, or
9
** (at your option) any later version.
11
** This program is distributed in the hope that it will be useful,
12
** but WITHOUT ANY WARRANTY; without even the implied warranty of
13
** MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14
** GNU General Public License for more details.
16
** You should have received a copy of the GNU General Public License
17
** along with this program; if not, write to the Free Software
18
** Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
22
include "include/config.inc.php";
23
$page["title"] = "S_ALARMS";
24
$page["file"] = "alarms.php";
25
$page["menu.url"] = "tr_status.php";
27
show_header($page["title"],0,0);
31
if(!check_right_on_trigger("R",$_REQUEST["triggerid"]))
33
show_table_header("<font color=\"AA0000\">".S_NO_PERMISSIONS."</font>");
40
$_REQUEST["limit"] = get_request("limit","NO");
41
if(is_numeric($_REQUEST["limit"]))
42
$_REQUEST["limit"] = 100;
44
$trigger=get_trigger_by_triggerid($_REQUEST["triggerid"]);
46
$expression=$trigger["expression"];
48
$expression=explode_exp($expression,1);
49
$description=expand_trigger_description($_REQUEST["triggerid"]);
52
$form->AddVar("triggerid",$_REQUEST["triggerid"]);
53
$cmbLimit = new CComboBox("limit",$_REQUEST["limit"],"submit()");
54
$cmbLimit->AddItem('NO',S_SHOW_ALL);
55
$cmbLimit->AddItem("100",S_SHOW_ONLY_LAST_100);
56
$form->AddItem($cmbLimit);
58
show_header2(S_ALARMS_BIG.":$description<br>$expression", $form);
62
$sql="select * from alarms where triggerid=".$_REQUEST["triggerid"].
63
" order by clock desc";
64
$result=DBselect($sql, $_REQUEST["limit"]);
66
$table = new CTableInfo();
67
$table->SetHeader(array(S_TIME,S_STATUS,S_ACKNOWLEDGED,S_DURATION,S_SUM,"%"));
74
while($row=DBfetch($result))
78
$leng=$lclock-$row["clock"];
80
// if($row["value"]==0) { echo "<TR BGCOLOR=#EEFFEE>"; }
81
// elseif($row["value"]==2) { echo "<TR BGCOLOR=#EEEEEE>"; }
82
// else { echo "<TR BGCOLOR=#FFDDDD>"; }
84
// table_td(date("Y.M.d H:i:s",$row["clock"]),"");
87
$istrue=new CCol(S_TRUE_BIG,"on");
88
$truesum=$truesum+$leng;
91
elseif($row["value"]==0)
93
$istrue=new CCol(S_FALSE_BIG,"off");
94
$falsesum=$falsesum+$leng;
97
elseif($row["value"]==3)
99
$istrue=new CCol(S_DISABLED_BIG,"unknown");
100
$dissum=$dissum+$leng;
103
elseif($row["value"]==2)
105
$istrue=new CCol(S_UNKNOWN_BIG,"unknown");
106
$dissum=$dissum+$leng;
110
$proc=(100*$sum)/($falsesum+$truesum+$dissum);
111
$proc=round($proc*100)/100;
114
// table_td("<B>$istrue</B>","");
117
$leng= round(($leng/(60*60*24))*10)/10;
122
$leng= round(($leng/(60*60))*10)/10;
127
$leng= round(($leng/(60))*10)/10;
137
$sum= round(($sum/(60*60*24))*10)/10;
142
$sum= round(($sum/(60*60))*10)/10;
147
$sum= round(($sum/(60))*10)/10;
155
// table_td($leng,"");
156
// table_td($sum,"");
157
// table_td($proc,"");
160
if($row["value"] == 1 && $row["acknowledged"] == 1)
162
$db_acks = get_acknowledges_by_alarmid($row["alarmid"]);
164
while($a=DBfetch($db_acks)) $rows++;
166
new CSpan(S_YES,"off"),
167
SPACE."(".$rows.SPACE,
169
"acknow.php?alarmid=".$row["alarmid"],"action"),
174
$table->ShowRow(array(
175
date("Y.M.d H:i:s",$row["clock"]),