LoginSignup
0
0

More than 5 years have passed since last update.

Zabbix、条件に合うトリガーを一括取得

Last updated at Posted at 2018-09-25

Zabbix UIではトリガーを細かな条件指定の上で検索がし辛く、トリガーの棚卸しを行う際手間がかかる。
そこでZabbixで使用しているMariaDBより条件指定したトリガーを一括取得する。

(例)トリガー名に「Zabbix」または「Disk」を含み、かつトリガーステータスが「有効」のものを検索


SELECT
  CASE 
    WHEN t.priority LIKE '0' THEN '未分類'
    WHEN t.priority LIKE '1' THEN '情報'
    WHEN t.priority LIKE '2' THEN '警告'
    WHEN t.priority LIKE '3' THEN '軽度の障害'
    WHEN t.priority LIKE '4' THEN '重度の障害'
    WHEN t.priority LIKE '5' THEN '致命的な障害'
  END "priority",
  h.host,
  t.description,
  t.expression,
  CASE
    WHEN t.status = '0' THEN '有効'
    WHEN t.status = '1' THEN '無効'
  END "status",
  t.error
FROM triggers t
  inner join functions f on t.triggerid = f.triggerid
  inner join items i on f.itemid = i.itemid
  inner join hosts h on i.hostid = h.hostid
WHERE
     t.description Like '%Zabbix%' 
  or t.description Like '%Disk%' 
  and t.status = '0'
ORDER BY t.priority;
0
0
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
0
0