This GitHub repository contains a script for integrating Gotify to be able send notifications with Zabbix. Follow these instructions to set up and use the script with your Zabbix and Gotify instances.
Before setting up the script, you will need to create an application in Gotify to generate an API token.
Log into your Gotify server:
Create a new application:
Apps
section;Create App
;Zabbix Notifications
;Create
.Copy the API Token:
gotify.sh
script.Clone the repository or download gotify.sh
from this repository.
Edit gotify.sh
to set up your Gotify server details:
http://change.me
with your Gotify server URL. For example, http://10.94.1.198
or https://gotify.example.com
.Copy the script to the Zabbix alertscripts directory, typically located at /usr/lib/zabbix/alertscripts/
.
sudo cp gotify.sh /usr/lib/zabbix/alertscripts/
Make the script executable:
sudo chmod +x /usr/lib/zabbix/alertscripts/gotify.sh
Log into your Zabbix frontend.
Navigate to Administration > Media Types
and click Create Media Type
.
Select Script
as the type and add a name, like Gotify
.
For the script name, enter gotify.sh
.
Define the following parameters:
{ALERT.SENDTO}
- Gotify API Token{ALERT.SUBJECT}
- Notification subject{ALERT.MESSAGE}
- Notification message{TRIGGER.SEVERITY}
- Trigger severity (used to determine priority in Gotify)Configure Message Templates:
Message templates
tab.Save the new Media Type.
In Zabbix frontend, go to Administration > Users
.
Edit the user who should receive Gotify notifications.
Under the Media
tab, add the Gotify media type.
In the Send to
field, enter your Gotify API Token.
Save the changes.
Create a test trigger or wait for an actual alert to verify that notifications are being sent correctly to Gotify.
http://change.me
in the gotify.sh
script with your actual Gotify server URL.