请输入图片描述

Get zCate and configure zabbix

iOS users can search for zabbix keywords in the App Store to find and download zCate.
Android users can click hereto download zCate for Android.

When you open the app for the first time, you will be prompted to log in. Fill in the zabbix address, username, and password. This information will only be saved on your phone and will not be sent to the zCate server.

Get zCate push tool

Visit this github link for zCate-Push-Tool and its source code.

  1. After downloading, change its name to zcate, and put it in the alertscripts directory of zabbix.
  2. Give executable permission chmod + x zcate. The default alertscripts directory is /usr/lib/zabbix/alertscripts. This directory is in zabbix-server.conf Settings.

Sign up for zCate account to get push token

Visit https://zcate.appgao.com, click Register, and fill in the necessary information on the next registration page to complete the registration.

Sign up for zCate account to get push token

The string in the red box after login is the token we need next.

zcate token

Set token in zCate

Click Settings -> Zabbix Alert in zCate, turn on the message push switch, and fill in the token you just registered in the token text box below.

When you exit this page, zCate will register pushes with the zCate server. You also need to check whether the system allows zCate to send pushes.

Set token in zCate

Test Push

Go back to the /usr/lib/zabbix/alertscripts directory and execute the command ./zcate --help, it will show how to use zcate.

Usage of ./zcate:
  -badge int
        Message notification badge (default 1)
  -body string
        Message body (require)
  -platform string
        iOS or Android (require)
  -subtitle string
        Message subtitle
  -title string
        Message title
  -token string
        Your token (require)

Run the following command to test push. IOS client needs to exit zCate to see the effect.

./zcate -badge 10 -body "message body" -platform all -subtitle "subtitle" -title "title" -token 530f269d03cd478c97ce

If nothing else, your client will receive a message with the title title, subtitle subtitle, content message body, and subscript (iOS only) 10. If you don't receive the message, check the network and enter the zabbix alert setup page several times.

zcate android push

zcate ios push

Set zabbix alarm media

Add new alarm media in zabbix management-> alarm media type, please refer to the picture below.

zabbix alarm media

Set zabbix action

Added actions in zabbix.

The content can use the following format, which supports markdown. For the display effect, refer to the third (recent alert) in the first picture of this article:

Title: {HOSTNAME1}: {TRIGGER.NAME}
content:

Alert level: {TRIGGER.SEVERITY}
Failure time: {EVENT.DATE} {EVENT.TIME}
Failure duration: {EVENT.AGE}
IP address: {HOST.IP}
Detections: {TRIGGER.KEY1}
# {ITEM.LASTVALUE}

Set zabbix action

Set up users

It is recommended to create a read-only user for zcate, and then add the alarm media just added in the user settings page. If there are no problems, you can test the zabbix alarm push here.

请输入图片描述

Filter unwanted alarm displays

When you select users with multiple alert media, you can see them all in "Recent Alerts", which may not meet our expectations, because there are many duplicates.

请输入图片描述

Here we only let him show the alarm generated by push, we need to get the action ID of action push first.

Edit this action in zabbix, we can get the action ID in the url.

http://zbx.qiansw.com/actionconf.php?form=update&actionid=12

Now we know that his action ID is 12, we only need to fill in 12 in the zcate settings -> Zabbix content display settings, if you need to display multiple ids, you can directly fill in multiple digits separated by commas, such as 12,13.

WechatIMG21.jpg

After completing the filling, zcate will only display the alarms generated by the actions we specified on the recent alarms page. Refer to the third picture in the first picture of this article.

Troubleshooting

If you encounter problems, you can find the contact information in zcate's settings-> about page.