19 Ocak 2020 Pazar

Tabbix Pro Push Notification Setup

To use push notification in Tabbix Pro,

1. Copy your device token from Tabbix Pro. To do that, go to Settings in Tabbix Pro. You will see the device token in here. We will use this token. You can copy and email it to yourself.

2. You need to create zabbix script to send notification to your device. Create a file named tabbix.sh with code as below.

export posturl=https://tabbix.azurewebsites.net/api/tabbixpro/send
export posttoken="$1"
export postsubject="$2"
export postbody="$3"

curl --data "token=$posttoken&subject=$postsubject&body=$postbody" $posturl

PS: The endpoint works only with POST method. When you use --data option with curl, it automatically make POST request.

3. Save this file in alertscripts folder in Zabbix server. My alertscripts folder is in this path /usr/lib/zabbix/alertscripts. You can find your path in zabbix_server.conf file.

4. Make tabbix.sh file executable with this command.
chmod +x tabbix.sh

5. Yo need to create new Media Type in Zabbix. Go to Administration > Media types in Zabbix Web user interface and click "Create media type" and fill fields as below

Name: Tabbix
Type : Script
Script name : tabbix.sh
Script Parameters:

Enabled : checked
Click Add.

6. Use this media in user. Go to Administration > Users. Click a user who want to use this meda. Click Media type tab and click Add to add Tabbix Media to that user. Fill fields as below

Type : Tabbix
Send to : Your device token that copied in first item.
When Active : You can chose day and times. You can leave as is if you don't need any limitation
Use if severity : You can choose severity. Leave as is if you don't need any limitation
Enabled : checked

Click Add.

Now you can use Tabbix media in your Actions whatever you want as your other actions.

Be careful when using push notification service. It use https service, but it is not E2E (end-to-end encryption).

General Help : https://tech.tirgil.com/2013/04/tabbix-help-tabbix-manual.html