Network Security Internet Technology Development Database Servers Mobile Phone Android Software Apple Software Computer Software News IT Information

In addition to Weibo, there is also WeChat

Please pay attention

WeChat public account

Shulou

Zabbix-docking nailing robot interface

2025-01-19 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Network Security >

Share

Shulou(Shulou.com)06/01 Report--

One: download the sender program

Zabbix nail alarm robot-sends an alarm message to the nail group chat (script written in go language, available with the-h view option)

Test:

. / golang-zabbix-robot-64-webhook=' https://oapi.dingtalk.com/roboxxxxxxxx'

At this point, your robot will send a message from Qiansi.com, indicating that golong is available.

Next, it's time to distinguish between the versions of your zabbix. Here are the configurations for 3.03.2 2.4.

Two: zabbix3.0 configuration

1. Deployment program

Copy the go script to the server warning directory AlertScriptspath and add execution permissions.

2. Create an alarm medium

3. Add users or groups and join the alarm media

4. Create actions and trigger sending conditions

Three: zabbix3.2 configuration

3.2is roughly the same as the 3.0configuration, except that some messages will not be delivered. Try to remove the line feeds in the above xml format and retest them.

Appendix:

Alarm message

{HOSTNAME1} {EVENT.DATE} {TRIGGER.SEVERITY} {TRIGGER.NAME} {TRIGGER.KEY1} {ITEM.LASTVALUE} {EVENT.ID} {HOST.IP} this is the link address {EVENT.AGE} {EVENT.STATUS} {EVENT.ACK.STATUS} {EVENT.ACK.HISTORY} that can be accessed by clicking on the alarm message.

Restore information

{HOSTNAME1} {EVENT.DATE} {TRIGGER.SEVERITY} {TRIGGER.NAME} {TRIGGER.KEY1} {ITEM.LASTVALUE} {EVENT.ID} {HOST.IP} FF4A934A the url here will replace the url {EVENT.AGE} {EVENT.RECOVERY.DATE} {EVENT.RECOVERY.TIME} {EVENT.RECOVERY.STATUS} of the alarm media.

Four: zabbix 2.4 configuration

Compared with version 3, 2.4 is classic but a little behind the times, and the company does not dare to upgrade hastily in order to maintain stability, so it can only configure 2.4 accordingly.

1. Deployment program

Also under the warning directory AlertScriptspath, add the script zabbix-dingding.sh

#! / bin/bash

Webhook= "https://oapi.dingtalk.com/robot/send?access_token=xxx"

/ zabbix/share/zabbix/alertscripts/golang-zabbix-robot-64-webhook=$webhook-msg= "$3"

2. Create an alarm medium

3. Create a user or group and join the alarm medium, as above

4. Create actions and trigger sending conditions in 3.2 format without line wrapping

-

Additional: general purpose robot

Sometimes we will use a custom monitoring script to monitor the status of the service, or a program, etc., how to connect to the nail?

#! / usr/bin/env python

# coding=utf-8

Import urllib

Import urllib2

Import json

Import re

F = open ('xxxxxxxxxx','r') # fetch the contents of the file and send it

Your_data = f.read ()

F.close ()

# print your_data

Headers = {'Content-Type':' application/json'}

Test_data = {

'msgtype': "text"

"text": {

'content': 's' your_data

}

"at": {

"atMobiles": [

# "you iphone"

]

"isAtAll": "false"

}

}

# requrl = "https://oapi.dingtalk.com/robot/send?access_token=xxxxxxxxxxxxxxxxxxxxxxxx"

Req = urllib2.Request (url = requrl,headers = headers,data = json.dumps (test_data))

Response = urllib2.urlopen (req)

Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.

Views: 0

*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.

Share To

Network Security

Wechat

© 2024 shulou.com SLNews company. All rights reserved.

12
Report