Skip to content

Instantly share code, notes, and snippets.

@danilochilene
Created October 21, 2015 13:09
Show Gist options
  • Save danilochilene/0a5ec3424208d59cfb88 to your computer and use it in GitHub Desktop.
Save danilochilene/0a5ec3424208d59cfb88 to your computer and use it in GitHub Desktop.
Export Zabbix triggers from MySQL
use zabbix
select DISTINCT h.host,g.name,t.description,h.hostid,t.triggerid,i.itemid,t.expression,t.value,t.comments,i.units,i.valuemapid,d.triggerdepid from hosts as h join items as i on (h.hostid = i.hostid) join functions as f on (i.itemid = f.itemid) join triggers as t on (f.triggerid = t.triggerid) left join trigger_depends as d on (d.triggerid_down = t.triggerid) INNER JOIN hosts_groups hg ON ( hg.hostid = h.hostid ) LEFT JOIN groups g ON ( g.groupid = hg.groupid ) where h.status = 0 and t.value = 0 and t.status = 0 and i.status = 0 ORDER BY h.host INTO OUTFILE '/tmp/triggers.txt';
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment