diff options
| author | osmiy <osmiy@97f52cf1-0a1b-0410-bd0e-c28be96e8082> | 2006-10-23 07:34:27 +0000 |
|---|---|---|
| committer | osmiy <osmiy@97f52cf1-0a1b-0410-bd0e-c28be96e8082> | 2006-10-23 07:34:27 +0000 |
| commit | 28a09ed13e41ddbe5e30d63e92a1f5fb3395ef89 (patch) | |
| tree | 8281ccd48964ee0dd11c5ea689091fa3cef706fb /frontends/php/include/events.inc.php | |
| parent | 495799b2aa61aab23d74d7faa110a0cd09d59bf0 (diff) | |
| download | zabbix-28a09ed13e41ddbe5e30d63e92a1f5fb3395ef89.tar.gz zabbix-28a09ed13e41ddbe5e30d63e92a1f5fb3395ef89.tar.xz zabbix-28a09ed13e41ddbe5e30d63e92a1f5fb3395ef89.zip | |
- developed group permission system (Eugene)
git-svn-id: svn://svn.zabbix.com/trunk@3371 97f52cf1-0a1b-0410-bd0e-c28be96e8082
Diffstat (limited to 'frontends/php/include/events.inc.php')
| -rw-r--r-- | frontends/php/include/events.inc.php | 63 |
1 files changed, 31 insertions, 32 deletions
diff --git a/frontends/php/include/events.inc.php b/frontends/php/include/events.inc.php index 9ba2239b..9e402ee1 100644 --- a/frontends/php/include/events.inc.php +++ b/frontends/php/include/events.inc.php @@ -20,39 +20,47 @@ ?> <?php - function get_history_of_events($start,$num, $groupid=0, $hostid=0) + function get_history_of_events($start,$num, $groupid=0, $hostid=0, $nodeid=null) { + global $ZBX_CURNODEID; + global $USER_DETAILS; + + if(is_null($nodeid)) $nodeid = $ZBX_CURNODEID; + + $sql_from = $sql_cond = ""; + if($hostid > 0) { - $sql="select distinct a.clock,a.value,a.triggerid from alarms a,functions f,items i where a.triggerid=f.triggerid and f.itemid=i.itemid and i.hostid=".$hostid." order by clock desc"; + $sql_cond = " and h.hostid=".$hostid; } elseif($groupid > 0) { - $sql="select distinct a.clock,a.value,a.triggerid from alarms a,functions f,items i where a.triggerid=f.triggerid and f.itemid=i.itemid and i.hostid=hg.hostid and hg.groupid=".$groupid." order by clock desc"; + $sql_from = ", hosts_groups hg "; + $sql_cond = " and h.hostid=hg.hostid and hg.groupid=".$groupid; } - else - { - $sql="select distinct triggerid,clock,value from alarms order by clock desc"; - } - $result=DBselect($sql,10*($start+$num)); + + $result = DBselect(" select t.triggerid,t.priority,t.description,h.host,e.clock,e.value ". + " from events e, triggers t, functions f, items i, hosts h ".$sql_from. + " where ".DBid2nodeid("t.triggerid")."=".$nodeid. + " and e.triggerid=t.triggerid and t.triggerid=f.triggerid and f.itemid=i.itemid ". + " and i.hostid=h.hostid ".$sql_cond." and h.status=".HOST_STATUS_MONITORED. + " and h.hostid not in (".get_accessible_hosts_by_user($USER_DETAILS,PERM_READ_WRITE, PERM_MODE_LT).") ". + " order by e.clock desc,h.host,t.priority,t.description,t.triggerid ", + 10*($start+$num) + ); $table = new CTableInfo(S_NO_EVENTS_FOUND); - $table->setHeader(array(S_TIME, S_DESCRIPTION, S_VALUE, S_SEVERITY)); + $table->SetHeader(array(S_TIME, $hostid == 0 ? S_HOST : null, S_DESCRIPTION, S_VALUE, S_SEVERITY)); $col=0; - $skip=$start; - while(($row=DBfetch($result))&&($col<100)) + + $skip = $start; + while(($row=DBfetch($result))&&($col<$num)) { - if(!check_right_on_trigger("R",$row["triggerid"])) - { - continue; - } if($skip > 0) { $skip--; continue; } - $description=expand_trigger_description($row["triggerid"]); - $description=new CLink($description,"alarms.php?triggerid=".$row["triggerid"],"action"); if($row["value"] == 0) { @@ -67,21 +75,12 @@ $value=new CCol(S_UNKNOWN_BIG,"unknown"); } - $trigger = get_trigger_by_triggerid($row["triggerid"]); - - if($trigger["priority"]==0) $priority=S_NOT_CLASSIFIED; - elseif($trigger["priority"]==1) $priority=new CCol(S_INFORMATION, "information"); - elseif($trigger["priority"]==2) $priority=new CCol(S_WARNING,"warning"); - elseif($trigger["priority"]==3) $priority=new CCol(S_AVERAGE,"average"); - elseif($trigger["priority"]==4) $priority=new CCol(S_HIGH,"high"); - elseif($trigger["priority"]==5) $priority=new CCol(S_DISASTER,"disaster"); - else $priority=$trigger["priority"]; - - $table->addRow(array( - date("Y.M.d H:i:s",$row["clock"]), - $description, - $value, - $priority)); + $table->AddRow(array( + date("Y.M.d H:i:s",$row["clock"]), + $hostid == 0 ? $row['host'] : null, + new CLink(expand_trigger_description_by_data($row),"tr_events.php?triggerid=".$row["triggerid"],"action"), + $value, + new CCol(get_severity_description($row["priority"]), get_severity_style($row["priority"])))); $col++; } |
