diff options
author | osmiy <osmiy@97f52cf1-0a1b-0410-bd0e-c28be96e8082> | 2007-03-22 08:53:23 +0000 |
---|---|---|
committer | osmiy <osmiy@97f52cf1-0a1b-0410-bd0e-c28be96e8082> | 2007-03-22 08:53:23 +0000 |
commit | 97583f76e5851df0c94ac1cb4d0f64ddf46a72e7 (patch) | |
tree | 0863d76cfa80dad985b671ab54f592f9f45d3f73 /frontends/php/include/events.inc.php | |
parent | 81f73b9332fae92a2da659d9a4edf31e87ccbf57 (diff) | |
download | zabbix-97583f76e5851df0c94ac1cb4d0f64ddf46a72e7.tar.gz zabbix-97583f76e5851df0c94ac1cb4d0f64ddf46a72e7.tar.xz zabbix-97583f76e5851df0c94ac1cb4d0f64ddf46a72e7.zip |
- added viwer of dicovery events (Eugene)
git-svn-id: svn://svn.zabbix.com/trunk@3907 97f52cf1-0a1b-0410-bd0e-c28be96e8082
Diffstat (limited to 'frontends/php/include/events.inc.php')
-rw-r--r-- | frontends/php/include/events.inc.php | 73 |
1 files changed, 72 insertions, 1 deletions
diff --git a/frontends/php/include/events.inc.php b/frontends/php/include/events.inc.php index 938fbb92..97c16981 100644 --- a/frontends/php/include/events.inc.php +++ b/frontends/php/include/events.inc.php @@ -20,7 +20,7 @@ ?> <?php - function get_history_of_events($start,$num, $groupid=0, $hostid=0, $nodeid=null) + function get_history_of_triggers_events($start,$num, $groupid=0, $hostid=0, $nodeid=null) { global $ZBX_CURNODEID; global $USER_DETAILS; @@ -89,4 +89,75 @@ } return $table; } + + function get_history_of_discovery_events($start,$num,$nodeid=null) + { + global $ZBX_CURNODEID; + global $USER_DETAILS; + + if(is_null($nodeid)) $nodeid = $ZBX_CURNODEID; + + $db_events = DBselect('select distinct e.source,e.object,e.objectid,e.clock,e.value from events e'. + ' where '.' e.source='.EVENT_SOURCE_DISCOVERY.' order by e.clock desc', + 10*($start+$num) + ); + + $table = new CTableInfo(S_NO_EVENTS_FOUND); + $table->SetHeader(array(S_TIME, S_IP, S_DESCRIPTION, S_STATUS)); + $col=0; + + $accessible_hosts = get_accessible_hosts_by_user($USER_DETAILS,PERM_READ_ONLY); + + $skip = $start; + while(($event_data = DBfetch($db_events))&&($col<$num)) + { + if($skip > 0) + { + $skip--; + continue; + } + + if($event_data["value"] == 0) + { + $value=new CCol(S_DOWN,"off"); + } + elseif($event_data["value"] == 1) + { + $value=new CCol(S_UP,"on"); + } + else + { + $value=new CCol(S_UNKNOWN_BIG,"unknown"); + } + + + switch($event_data['object']) + { + case EVENT_OBJECT_DHOST: + $object_data = DBfetch(DBselect('select ip from dhosts where dhostid='.$event_data['objectid'])); + $description = SPACE; + break; + case EVENT_OBJECT_DSERVICE: + $object_data = DBfetch(DBselect('select h.ip,s.type,s.port from dhosts h,dservices s '. + ' where h.dhostid=s.dhostid, s.dserviceid='.$event_data['objectid'])); + $description = S_SERVICE.': '.discovery_check_type2str($object_data['type']).'; '. + S_PORT.': '.$object_data['port']; + break; + default: + continue; + } + + if(!$object_data) continue; + + + $table->AddRow(array( + date("Y.M.d H:i:s",$event_data["clock"]), + $object_data['ip'], + $description, + $value)); + + $col++; + } + return $table; + } ?> |