Tuesday, February 12, 2013

Zabbix queue.

To get a full overview of zabbix queue, this query is very usefull. Modify it as you like.
SELECT to_timestamp(i.lastclock) as last,h.host,h.ip,i.delay,i.type,i.snmp_oid,i.snmp_community,i.description,i.key_,h.proxy_hostid
FROM items i,hosts h 
WHERE i.hostid=h.hostid 
             AND h.status=0
             AND i.status=0
             AND i.delay < 3600
             AND i.value_type not in (2)
             AND NOT i.lastclock IS NULL
             AND i.lastclock > extract (epoch from timestamp '2013-02-07 00:00:00')
             AND i.lastclock < extract (epoch from timestamp '2013-02-08 00:00:00')
             AND (
                 i.type in (0,13,14,3,5,11,8,10,15)
                   OR (h.available<>2 AND i.type in (0))
                   OR (h.snmp_available<>2 AND i.type in (1,4,6))
                   OR (h.ipmi_available<>2 AND i.type in (12))
                 )
                 ORDER BY i.lastclock,h.host,i.description,i.key_ limit 10000;