Difference between revisions of "Zabbix sql queries"
Jump to navigation
Jump to search
Line 37: | Line 37: | ||
) | ) | ||
LIMIT 1; | LIMIT 1; | ||
+ | -- ORDER BY priority DESC; | ||
``` | ``` |
Revision as of 16:35, 1 October 2022
delete from items where hostid=(select hostid from hosts where host='www.example.com'); delete from items where hostid=(select hostid from hosts where host='www.example.com') and itemid!=252623 and itemid!=253055;
Not sure if work
SELECT DISTINCT host, f.triggerid, e.acknowledged, priority 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 / 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 / 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 ) LIMIT 1; -- ORDER BY priority DESC;