19 Ocak 2020 Pazar

Tabbix Push Notification Setup

To use push notification in Tabbix,

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


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

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

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

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:
1. {ALERT.SENDTO}
2. {ALERT.SUBJECT}
3. {ALERT.MESSAGE}

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.

Important
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

Donation : https://www.paypal.com/cgi-bin/webscr?cmd=_s-xclick&hosted_button_id=B6U73VZ6F3BG4&source=url