Zabbix — MySQL запрос на выборку текущих активных алертов
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 |
SELECT groups.name, hosts.hostid, hosts.host, triggers.description, triggers.comments, triggers.triggerid, triggers.priority FROM triggers INNER JOIN functions ON triggers.triggerid=functions.triggerid INNER JOIN items ON items.itemid=functions.itemid INNER JOIN hosts ON hosts.hostid=items.hostid INNER JOIN hosts_groups ON hosts_groups.hostid=hosts.hostid INNER JOIN groups ON groups.groupid=hosts_groups.groupid WHERE hosts.status = 0 AND items.status = 0 AND triggers.status = 0 AND triggers.priority=3 AND triggers.value=1; |
Выбираем кто из пользователей Zabbix видит хост:
1 2 3 4 5 6 7 8 9 10 11 12 13 |
SELECT usrgrp.usrgrpid , usrgrp.name AS user_group , groups.name as host_group , host FROM users JOIN users_groups ON users.userid = users_groups.userid JOIN usrgrp ON users_groups.usrgrpid = usrgrp.usrgrpid JOIN rights ON usrgrp.usrgrpid = rights.groupid JOIN groups ON rights.id = groups.groupid JOIN hosts_groups ON groups.groupid = hosts_groups.groupid JOIN hosts on hosts_groups.hostid = hosts.hostid where hosts.hostid=1025; |