To receive incoming webhook alerts in Zabbix, you need to configure the following components on the Zabbix frontend:
-
Create a Zabbix host for the webhook listener: Go to Configuration -> Hosts. Click on "Create host" to add a new host. Provide a Hostname and an IP address or DNS name for the webhook listener. Choose a Group for the host (e.g., "Webhook Listeners"). Click on "Templates" and link the appropriate Zabbix templates for monitoring.
-
Create a Zabbix item to receive the webhook alerts: Go to Configuration -> Hosts. Find and click on the webhook listener host you created. Click on "Items" and then "Create item". Configure the following settings: Name: Provide a name for the item (e.g., "Webhook Alert"). Type: Select "Zabbix trapper". Key: Enter a unique key (e.g., "webhook.alert"). Type of information: Choose "Text". Update interval: Set an appropriate interval for checking the item (e.g., 30 seconds). Other settings: Configure as needed. Save the item.
-
Create a Zabbix trigger to generate alerts based on the webhook item value: Go to Configuration -> Hosts. Find and click on the webhook listener host. Click on "Triggers" and then "Create trigger". Configure the following settings: Name: Provide a name for the trigger (e.g., "Webhook Alert Trigger"). Expression: Set the expression to trigger based on the item value (e.g., {Webhook Listener:webhook.alert.strlen()}>0). Severity: Choose an appropriate severity level for the trigger. Recovery expression: Optionally, set a recovery expression if needed. Tags and dependencies: Configure as needed. Save the trigger.
Once you have configured the Zabbix host, item, and trigger, the webhook listener script will send alerts to Zabbix using the Zabbix sender. These alerts will trigger the defined Zabbix trigger, which can be used to generate notifications, escalate incidents, or perform other actions based on your Zabbix configuration.