Hi.
I've cloned Zabbix make_latest_issues function source and successfully modified it for a periodic report which shows all Active events
(for emailing a team that is not required to know how to use Zabbix)
Now I'm having trouble getting it to filter out the corresponding Acknowledged events.
Adding,
I was expecting it to only return the Active events which are not Acknowledged, however...
for each Active Acknowledged event, it returns the previous historic
(non active) event as seen in,
the 'Events List [Previous 20]' from zabbix/tr_events.php?triggerid=_trigger_id&eventid=_event _id&sid=_session_id
Which condition change am I missing?
I've cloned Zabbix make_latest_issues function source and successfully modified it for a periodic report which shows all Active events
(for emailing a team that is not required to know how to use Zabbix)
Now I'm having trouble getting it to filter out the corresponding Acknowledged events.
Adding,
' AND e.acknowledged=0'.
for each Active Acknowledged event, it returns the previous historic
(non active) event as seen in,
the 'Events List [Previous 20]' from zabbix/tr_events.php?triggerid=_trigger_id&eventid=_event _id&sid=_session_id
$sql = 'SELECT DISTINCT t.triggerid,t.status,t.description, t.priority, t.lastchange,t.value,h.host,h.hostid '.
' FROM triggers t,hosts h,items i,functions f, hosts_groups hg '.
' WHERE f.itemid=i.itemid '.
' AND h.hostid=i.hostid '.
' AND hg.hostid=h.hostid '.
' AND t.triggerid=f.triggerid '.
' AND t.status='.TRIGGER_STATUS_ENABLED.
' AND t.value = 1 '.
' AND t.status=0 '.
// ' AND '.DBin_node('t.triggerid').
' AND '.DBcondition('t.triggerid',$available_triggers).
' AND h.status='.HOST_STATUS_MONITORED.
' AND h.hostid IN (select hostid from hosts_groups where groupid IN (16,27))'.
' ORDER BY t.lastchange DESC';
}
$result = DBselect($sql);
while($row=DBfetch($result)){
// Check for dependencies
if(trigger_dependent($row["triggerid"])) continue;
$event_sql = 'SELECT e.eventid, e.value, e.clock, e.objectid as triggerid, e.acknowledged, t.type '.
' FROM events e, triggers t '.
' WHERE e.object='.EVENT_SOURCE_TRIGGERS.
// Filter by unacknowledged Events
' AND e.acknowledged=0'.
' AND e.objectid='.$row['triggerid'].
' AND t.triggerid=e.objectid '.
' ORDER by e.object DESC, e.objectid DESC, e.eventid DESC';
' FROM triggers t,hosts h,items i,functions f, hosts_groups hg '.
' WHERE f.itemid=i.itemid '.
' AND h.hostid=i.hostid '.
' AND hg.hostid=h.hostid '.
' AND t.triggerid=f.triggerid '.
' AND t.status='.TRIGGER_STATUS_ENABLED.
' AND t.value = 1 '.
' AND t.status=0 '.
// ' AND '.DBin_node('t.triggerid').
' AND '.DBcondition('t.triggerid',$available_triggers).
' AND h.status='.HOST_STATUS_MONITORED.
' AND h.hostid IN (select hostid from hosts_groups where groupid IN (16,27))'.
' ORDER BY t.lastchange DESC';
}
$result = DBselect($sql);
while($row=DBfetch($result)){
// Check for dependencies
if(trigger_dependent($row["triggerid"])) continue;
$event_sql = 'SELECT e.eventid, e.value, e.clock, e.objectid as triggerid, e.acknowledged, t.type '.
' FROM events e, triggers t '.
' WHERE e.object='.EVENT_SOURCE_TRIGGERS.
// Filter by unacknowledged Events
' AND e.acknowledged=0'.
' AND e.objectid='.$row['triggerid'].
' AND t.triggerid=e.objectid '.
' ORDER by e.object DESC, e.objectid DESC, e.eventid DESC';

Comment