One of the key features of Zabbix is the ability to automate actions and operations based on predefined events. These mechanisms allow administrators to react automatically to problems, recoveries, and discoveries without manual intervention.
This guide explains how actions and operations work in Zabbix and how to configure them to automate monitoring workflows. You will learn how to create trigger-based, discovery, and internal actions, as well as how to define operations for alerts and automation.
Actions in Zabbix
Actions in Zabbix define what should happen when specific events occur. An action consists of conditions and one or more operations that are executed when those conditions are met.
There are several types of actions that you can use to automate tasks. Here are some common types of actions and how to use them:
- Trigger actions allow you to perform actions when a trigger status changes. For example, you can configure Zabbix to send an email notification to a specific user when a trigger changes from "OK" to "PROBLEM".
- Auto-registration actions allow Zabbix to automatically register new hosts based on predefined rules, reducing manual configuration when monitoring dynamic environments.
- Internal actions are actions that are triggered by internal events within Zabbix. For example, you can configure Zabbix to automatically add a new item to a host when a new template is linked to the host.
Creating Actions in Zabbix
To create an action in Zabbix, follow these steps:
Click on "Configuration" in the main menu, and then click on the desired type of action under "Actions".
Click on the "Create action" button to create a new action.
Enter a name for the action and select the trigger that will activate the action.
Under the "Operations" tab, you can define the actions that will be performed when the trigger is activated. You can add multiple operations to a single action.
Operations in Zabbix
Operations in Zabbix are individual tasks executed as part of an action. Each operation represents a specific response to an event.
Some of the tasks are:
- send message;
- remote commands, including IPMI and scripts.
And the ones available for discovery actions:
- Add host: Automatically adds a new host to Zabbix when a trigger is activated.
- Remove host: Automatically removes a host from Zabbix when a trigger is activated.
- Enable host: Enables monitoring for a host that has been previously disabled.
- Disable host: Disables monitoring for a host, preventing further data collection and triggering of alerts.
- Add to the group: Adds a host to a specific host group for organizational purposes.
- Delete from group: Removes a host from a specific host group.
- Link to the template: Associates a host with a specific monitoring template, which defines the checks and metrics that will be collected for that host.
- Unlink from template: Removes the association between a host and a monitoring template.
Adding and Managing Operations in Zabbix
Click on the "Operations". Choose the type of operation you want to add, “Operations” works on the trigger, “Recovery operations” reacts to problems resolving, and Update operations activate on problems being updated by other users.
Choose the type of operation you want to create.
Enter the required details for the operation. For example, if you are creating a "Send message" operation, you will need to enter the recipient's email address and the message text.
As you add more operations they will get the step numbers, you can determine the time it takes for Zabbix to go from step 1 to step 2, etc, and how many times those steps are repeated.
Also you can add conditions for those operations to work, like acknowledgment of the problem, and such.
Save the operation.
Conclusion
Actions and operations in Zabbix provide powerful automation capabilities for monitoring environments. Proper configuration allows administrators to automate notifications, host management, and remediation tasks, improving response time and reducing manual effort.