LoginSignup
11

More than 5 years have passed since last update.

Zabbixで特定の曜日、時間帯に特定のトリガーを抑止する方法

Posted at

はじめに

特定の曜日、時間帯だけ特定のトリガーが実行されないようにしたい

という事を言われて、調べて見たら結構面倒くさかったのでメモです

環境

  • Zabbix server v2.0.8 (revision 38017) (21 August 2013)

要件

  • 以下の監視条件を満たしたい
    1. 日曜の2:00~6:00まで特定のトリガーの監視を抑制
    2. 日曜以外の2:00~4:00まで特定のトリガーの監視を抑制

使う関数

Zabbixに用意されている以下の関数を使用

  • dayofweek
  • time

条件式

元の条件式
{Template_name:proc.num[pop3d,,sleep].count(#2,0,eq)}=2
日曜の2:00~6:00まで特定のトリガーの監視を抑制する条件式
(({Template_name:proc.num[pop3d,,sleep].dayofweek(0)}=7) and
({Tmplate_name:proc.num[pop3d,,sleep].time(0)}>020000 and
{Tmplate_name:proc.num[pop3d,,sleep].time(0)}<060000)=0)
日曜以外の2:00~4:00まで特定のトリガーの監視を抑制する条件式
(({Template_name:proc.num[pop3d,,sleep].dayofweek(0)}<7) and
({Tmplate_name:proc.num[pop3d,,sleep].time(0)}>020000 and
{Tmplate_name:proc.num[pop3d,,sleep].time(0)}<040000)=0)
最終的な条件式
{Template_name:proc.num[pop3d,,sleep].count(#2,0,eq)}=2 and

((({Template_name:proc.num[pop3d,,sleep].dayofweek(0)}=7) and
({Tmplate_name:proc.num[pop3d,,sleep].time(0)}>020000 and
{Tmplate_name:proc.num[pop3d,,sleep].time(0)}<060000)=0) or

(({Template_name:proc.num[pop3d,,sleep].dayofweek(0)}=7) and
({Tmplate_name:proc.num[pop3d,,sleep].time(0)}>020000 and
{Tmplate_name:proc.num[pop3d,,sleep].time(0)}<040000)=0))

おわりに

このぐらいの複雑度になるとZabbixで条件式書くのがとってもツラたん

参考

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
11