** THIS IS STILL UNDER DEVELOPMENT ** Zabbix Template and related media type in order to manage dynamic maintenance on Zabbix using a local agent trapper item You will have to create the related action as "Actions" cannot be imported.
This hack allows the creation of Zabbix maintenances from the agent side using a specific trapper item. The trapper item triggers an associated action that create or delete the maintenance.
Import the template file
Import the media type file
Go to "Configuration > Actions" and click on "Create action" button.
- Set "name" to ZabbixMaintenance
- Create a new condition with "Trigger name" > "contains" > "ZabbixMaintenance"
- In "Operations" tab, add on operation that sends to "ZabbixMaintenance" the message "{ITEM.VALUE}"
zabbix_sender -c /etc/zabbix/zabbix_agentd.conf -k ZabbixMaintenance -o ""
action=<create|delete> comment= host= or group=
tag=:(:<operator[0|2]]>), default operator 0 (equals) duration=, default 60 minutes nodata, default maintenance is with data collection, use nodata to disable data collection
zabbix_sender -c /etc/zabbix/zabbix_agentd.conf -k ZabbixMaintenance -o "action=create;comment=test maintenance B test-host2 with 2 tags and no data collection;host=test-host2;tag=SYSTEM:Linux;tag=tag1:contains1:2;nodata"
zabbix_sender -c /etc/zabbix/zabbix_agentd.conf -k ZabbixMaintenance -o "action=create;duration=30;comment=test maintenance D with group TEST_HGP and 1 tag equal;group=TEST_HGP;tag=SYSTEM:windows"
zabbix_sender -c /etc/zabbix/zabbix_agentd.conf -k ZabbixMaintenance -o "action=delete;group=TEST1_HGP"
Tested on Zabbix version >= 5.0.4 you can test various use cases with the test file
Action logs will output in standard Zabbix server's logs in /var/log/zabbix/zabbix_server.log. All logs are prefixed with "ZabbixMaintenance" keyword.