hello,
i try to select in sql all server, (last trigger of each server) and (last severity of the last trigger), and description of the trigger
i use this sql command but i have more trigger for one server :
SELECT DISTINCT host, f.triggerid, severity, e.name
FROM triggers t
INNER JOIN functions f ON ( f.triggerid = t.triggerid )
INNER JOIN items i ON ( i.itemid = f.itemid )
INNER JOIN hosts ON ( i.hostid = hosts.hostid )
INNER JOIN events e ON ( e.objectid = t.triggerid )
WHERE (e.eventid DIV 100000000000000)
IN (0)
AND e.object = 0
AND t.value=1
AND hosts.status = 0
AND i.status = 0
AND t.status = 0
AND e.acknowledged = 0
AND e.clock > (SELECT DISTINCT max(e.clock)
FROM triggers t
INNER JOIN functions f ON ( f.triggerid = t.triggerid )
INNER JOIN items i ON ( i.itemid = f.itemid )
INNER JOIN hosts ON ( i.hostid = hosts.hostid )
INNER JOIN events e ON ( e.objectid = t.triggerid )
WHERE (e.eventid DIV 100000000000000)
IN (0)
AND e.object = 0
AND t.value=1
AND hosts.status = 0
AND i.status = 0
AND t.STATUS = 0
AND e.acknowledged = 1
)
ORDER BY severity DESC;
i try to select in sql all server, (last trigger of each server) and (last severity of the last trigger), and description of the trigger
i use this sql command but i have more trigger for one server :
SELECT DISTINCT host, f.triggerid, severity, e.name
FROM triggers t
INNER JOIN functions f ON ( f.triggerid = t.triggerid )
INNER JOIN items i ON ( i.itemid = f.itemid )
INNER JOIN hosts ON ( i.hostid = hosts.hostid )
INNER JOIN events e ON ( e.objectid = t.triggerid )
WHERE (e.eventid DIV 100000000000000)
IN (0)
AND e.object = 0
AND t.value=1
AND hosts.status = 0
AND i.status = 0
AND t.status = 0
AND e.acknowledged = 0
AND e.clock > (SELECT DISTINCT max(e.clock)
FROM triggers t
INNER JOIN functions f ON ( f.triggerid = t.triggerid )
INNER JOIN items i ON ( i.itemid = f.itemid )
INNER JOIN hosts ON ( i.hostid = hosts.hostid )
INNER JOIN events e ON ( e.objectid = t.triggerid )
WHERE (e.eventid DIV 100000000000000)
IN (0)
AND e.object = 0
AND t.value=1
AND hosts.status = 0
AND i.status = 0
AND t.STATUS = 0
AND e.acknowledged = 1
)
ORDER BY severity DESC;