diff options
| author | artem <artem@97f52cf1-0a1b-0410-bd0e-c28be96e8082> | 2008-03-07 09:05:11 +0000 |
|---|---|---|
| committer | artem <artem@97f52cf1-0a1b-0410-bd0e-c28be96e8082> | 2008-03-07 09:05:11 +0000 |
| commit | 4c4c7ec61d8d890ff596acbc2737aa0f36d54d6f (patch) | |
| tree | 8867312c2526a405e3744c0a43405f0119f0871b /frontends/php/include/blocks.inc.php | |
| parent | 83a181ece51f0e7527cea5f8531ccf6627949aae (diff) | |
| download | zabbix-4c4c7ec61d8d890ff596acbc2737aa0f36d54d6f.tar.gz zabbix-4c4c7ec61d8d890ff596acbc2737aa0f36d54d6f.tar.xz zabbix-4c4c7ec61d8d890ff596acbc2737aa0f36d54d6f.zip | |
- [DEV-122] {beta} Improved events (Artem)
git-svn-id: svn://svn.zabbix.com/trunk@5460 97f52cf1-0a1b-0410-bd0e-c28be96e8082
Diffstat (limited to 'frontends/php/include/blocks.inc.php')
| -rw-r--r-- | frontends/php/include/blocks.inc.php | 91 |
1 files changed, 65 insertions, 26 deletions
diff --git a/frontends/php/include/blocks.inc.php b/frontends/php/include/blocks.inc.php index 2e175712..c6a094a7 100644 --- a/frontends/php/include/blocks.inc.php +++ b/frontends/php/include/blocks.inc.php @@ -274,41 +274,80 @@ function make_system_summary($available_hosts=false){ $actions= new CTable(' - '); $sql='SELECT COUNT(a.alertid) as all'. - ' FROM alerts a '. - ' WHERE a.eventid='.$row_inf_event['eventid']; - - $alerts=DBfetch(DBselect($sql)); + ' FROM alerts a,functions f,items i,events e'. + ' WHERE a.eventid='.$row_inf_event['eventid']. + ' AND e.eventid = a.eventid'. + ' AND f.triggerid=e.objectid '. + ' AND i.itemid=f.itemid '. + ' AND i.hostid IN ('.$available_hosts.') '; + $alerts=DBfetch(DBselect($sql)); + if(isset($alerts['all']) && ($alerts['all'] > 0)){ + $mixed = 0; +// Sent $sql='SELECT COUNT(a.alertid) as sent '. - ' FROM alerts a '. + ' FROM alerts a,functions f,items i,events e'. ' WHERE a.eventid='.$row_inf_event['eventid']. - ' AND a.status='.ALERT_STATUS_SENT; - $alerts=DBfetch(DBselect($sql)); - - $tdl = new CCol(($alerts['done'])?(new CSpan($alerts['sent'],'green')):SPACE); - $tdl->AddOption('width','10'); - + ' AND a.status='.ALERT_STATUS_SENT. + ' AND e.eventid = a.eventid'. + ' AND f.triggerid=e.objectid '. + ' AND i.itemid=f.itemid '. + ' AND i.hostid IN ('.$available_hosts.') '; + + $tmp=DBfetch(DBselect($sql)); + $alerts['sent'] = $tmp['sent']; + $mixed+=($alerts['sent'])?ALERT_STATUS_SENT:0; +// In progress $sql='SELECT COUNT(a.alertid) as inprogress '. - ' FROM alerts a '. + ' FROM alerts a,functions f,items i,events e'. ' WHERE a.eventid='.$row_inf_event['eventid']. - ' AND a.status='.ALERT_STATUS_NOT_SENT; - $alerts=DBfetch(DBselect($sql)); - - $tdc = new CCol(($alerts['inprogress'])?(new CSpan($alerts['inprogress'],'orange')):SPACE); - $tdc->AddOption('width','10'); - + ' AND a.status='.ALERT_STATUS_NOT_SENT. + ' AND e.eventid = a.eventid'. + ' AND f.triggerid=e.objectid '. + ' AND i.itemid=f.itemid '. + ' AND i.hostid IN ('.$available_hosts.') '; + + $tmp=DBfetch(DBselect($sql)); + $alerts['inprogress'] = $tmp['inprogress']; +// Failed $sql='SELECT COUNT(a.alertid) as failed '. - ' FROM alerts a '. + ' FROM alerts a,functions f,items i,events e'. ' WHERE a.eventid='.$row_inf_event['eventid']. - ' AND a.status='.ALERT_STATUS_FAILED; - $alerts=DBfetch(DBselect($sql)); - $tdr = new CCol(($alerts['failed'])?(new CSpan($alerts['failed'],'red')):SPACE); - $tdr->AddOption('width','10'); - - $actions->AddRow(array($tdl,$tdc,$tdr)); + ' AND a.status='.ALERT_STATUS_FAILED. + ' AND e.eventid = a.eventid'. + ' AND f.triggerid=e.objectid '. + ' AND i.itemid=f.itemid '. + ' AND i.hostid IN ('.$available_hosts.') '; + + $tmp=DBfetch(DBselect($sql)); + $alerts['failed'] = $tmp['failed']; + $mixed+=($alerts['failed'])?ALERT_STATUS_FAILED:0; + + + if($alerts['inprogress']){ + $status = new CSpan(S_IN_PROGRESS,'orange'); + } + else if(ALERT_STATUS_SENT == $mixed){ + $status = new CSpan(S_OK,'green'); + } + else if(ALERT_STATUS_FAILED == $mixed){ + $status = new CSpan(S_FAILED,'red'); + } + else{ + $tdl = new CCol(($alerts['sent'])?(new CSpan($alerts['sent'],'green')):SPACE); + $tdl->AddOption('width','10'); + + $tdr = new CCol(($alerts['failed'])?(new CSpan($alerts['failed'],'red')):SPACE); + $tdr->AddOption('width','10'); + + $status = new CRow(array($tdl,$tdr)); + } + + $actions->AddRow($status); } -//-------- +//-------- + $table_inf->AddRow(array( get_node_name_by_elid($row_inf['triggerid']), $host, |
