📜 ⬆️ ⬇️

Disable triggers in ZABBIX on schedule

I think many have wondered how to disable triggers in zabbix at the time of the predicted load, for example, at the time of the backups. And I think many have easily resolved this issue, well, and those who have not yet figured out how to implement it, welcome under the cat!

Most recently, I met zabbix and I hasten to share my experiences with the community. There are two developments so far, this and the second about low-level discovery of services, such as zabbix, mysql, postgress, and generally any services, there will be work with the zabbix API, a Python script and a little Bash.

Of course, I had known him before, but not so close.

And now in the case:
')
The whole trick is to add in the trigger expression an additional condition that will verify the trigger trigger time with the time specified with the inaction of the trigger.

Description of triggering a new condition
{   }  ( { }  {   }  { }  {    ) 


The expression itself and the screenshot:


 {Iostat-Disk-Utilization-Template:iostat.metric[{#HARDDISK},util].avg({$TIME_DISK_HIGH})}>{$RATE_DISK_HIGH} and ({Iostat-Disk-Utilization-Template:iostat.metric[{#HARDDISK},util].time()}<{$DISABLED_TIME_START} or {Iostat-Disk-Utilization-Template:iostat.metric[{#HARDDISK},util].time()}>{$DISABLED_TIME_STOP}) 


Macro Description


For flexible configuration of the triggering parameters of disc utilization triggers, I added four macros:

 {$TIME_DISK_HIGH} -       " " {$RATE_DISK_HIGH} -       " " {$RATE_DISK__WARNING} -       " " {$TIME_DISK_WARNING} -       " " 

And two macros to disable the trigger:
 {$DISABLED_TIME_START} -     {$DISABLED_TIME_STOP} -     


In the template, in macros, you must specify the parameters of high and medium load on the disks, as well as the initial and final idle time of the trigger by default.

And on clients to edit these templates for individual customization.
To modify macros on clients, open:
“Host and inherited macros” and click on the edit button next to the required macro, after changing the macro will appear on the “Host macros” tab.



By default, the start time of inactivity of the trigger is set as 000000 and the final time as 000001. That is, the trigger will be inactive for exactly one second from 00 hours, 00 minutes and 00 seconds to 00 hours, 00 minutes and 01 seconds.

Original rework template

And ready template

PS


During the experiments, it turned out that if you try to somehow reduce the inactivity time of a trigger, for example, in the expression of a trigger, use <= and> = or specify a time equal to the beginning and end, the trigger either does not work at all or the off time does not work.

Source: https://habr.com/ru/post/347584/


All Articles