In addition to Weibo, there is also WeChat
Please pay attention
WeChat public account
Shulou
2025-04-06 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Network Security >
Share
Shulou(Shulou.com)06/01 Report--
Before the nailing robot was launched, we still used custom applications to achieve alarm. The effect and configuration are as follows:
One: download the sender program
Https://www.qiansw.com/golang-zabbix-alter-to-dingding.html go language
Test:
In fact, I understand the robot alarm method, which is roughly similar, except that webhook has become the application of id.
Golang-zabbix-alter-to-dingding.exe-agentid=794723-corpid=dingd6757aa75040e32b-corpsecret=z
C5Jbed9Sx8o9ZwfN4QgFo420WWlKw8NbSDYvk6Qin7gflFIIYLSeq4ZrdOVpk1o-to=manager5675-msg= "{\" from\ ":\" Tomcat03\ "
,\ "time\":\ "14:45:24 on July 28, 2016,\" level\ ":\" Warning\ ",\" name\ ":\" Response time is too high on Tomcat03\ ",\" key\ ":\" icmppingsec "
\ ",\" value\ ":\" 31ms\ ",\" now\ ":\" 31ms\ ",\" id\ ":\" 1618\ ",\" ip\ ":\" 10.139.105.107\ ",\" color\ ":\" FF4A934A\ ",\" age\ ":\" 3m\ ",\" reco
VeryTime\ ":\" 14:48:24 on July 28, 2016,\ "status\":\ "OK\"} "
You can use golang-zabbix-alter-to-dingding.exe-h to see what parameters there are.
-agentid string
AgentID, which can be viewed in the nail background, but cannot be empty.
-corpid string
CorpID, which can be viewed in the nail background, but cannot be empty.
-corpsecret string
CorpSecret, which can be viewed in the nail background, but cannot be empty.
-msg string
Text message content in Json format, which cannot be empty. (default "{\" from\ ":\" net\ ",\" time\ ":\" 1970-07-01 08:00:00\ ",\" level\ ":\" urgent\ ",\ t\" name\ ":\" this is a ZABBIX nailing alarm plug-in provided by qiansw.com. \ ",\ key\":\ "icmpping\",\ "value\":\ "Down (0)\",\ "now\":\ "Down (0)\",\ t\ "id\":\ "1511\",\ "ip\":\ "8.8.8.8\"} ")
-to string
The recipient of the message can be viewed in the nail background, but empty. (default "@ all")
-url string
Click on the message content and jump to the URL, which can be empty. (default "https://www.qiansw.com/golang-zabbix-alter-to-dingding.html")
1. Add application configuration to nails
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 (the following is json format, and the following is xml format)
3. Add user or group management-"user -" alarm medium-"add. Please fill in the operation and maintenance department that the recipient has set for us."
(please refer to the configuration of the docking robot)
4. Create actions and trigger sending conditions
Where "color": "FFE61A1A", color is followed by the color of the message header, which you can customize.
The first two bits are transparency, and the last six bits are color values, which you can get by querying the color picker.
Alarm message
{
"from": "{HOSTNAME1}"
"time": "{EVENT.DATE} {EVENT.TIME}"
"level": "{TRIGGER.SEVERITY}"
"name": "{TRIGGER.NAME}"
"key": "{TRIGGER.KEY1}"
"value": "{ITEM.VALUE}"
"now": "{ITEM.LASTVALUE}"
"id": "{EVENT.ID}"
"ip": "{HOST.IP}"
"color": "FFE61A1A"
"age": "{EVENT.AGE}"
"status": "{EVENT.STATUS}"
} restore information
{
"from": "{HOSTNAME1}"
"time": "{EVENT.DATE} {EVENT.TIME}"
"level": "{TRIGGER.SEVERITY}"
"name": "{TRIGGER.NAME}"
"key": "{TRIGGER.KEY1}"
"value": "{ITEM.VALUE}"
"now": "{ITEM.LASTVALUE}"
"id": "{EVENT.ID}"
"ip": "{HOST.IP}"
"color": "FF4A934A"
"age": "{EVENT.AGE}"
"recoveryTime": "{EVENT.RECOVERY.DATE} {EVENT.RECOVERY.TIME}"
"status": "{EVENT.RECOVERY.STATUS}"
}
-
Change record 2016-08-01 21:22 added support for xml source messages to prevent message failures caused by quotation marks in messages in json format. 2017-01-09 13:08 added support for url fields in messages.
2. Create an alarm medium (the following is json format, and the following is xml format)
3. Add user or group management-"user -" alarm medium-"add. Please fill in the operation and maintenance department that the recipient has set for us."
(please refer to the configuration of the docking robot)
4. Create actions and trigger sending conditions
Alarm message
{HOSTNAME1}
{EVENT.DATE} {EVENT.TIME}
{TRIGGER.SEVERITY}
{TRIGGER.NAME}
{TRIGGER.KEY1}
{ITEM.VALUE}
{ITEM.LASTVALUE}
{EVENT.ID}
{HOST.IP}
FFE61A1A
The url here will replace the url of the alarm medium.
{EVENT.AGE}
{EVENT.STATUS}
{EVENT.ACK.STATUS}
{EVENT.ACK.HISTORY}
Restore information
{HOSTNAME1}
{EVENT.DATE} {EVENT.TIME}
{TRIGGER.SEVERITY}
{TRIGGER.NAME}
{TRIGGER.KEY1}
{ITEM.VALUE}
{ITEM.LASTVALUE}
{EVENT.ID}
{HOST.IP}
FF4A934A
The url here will replace the url of the alarm medium.
{EVENT.AGE}
{EVENT.RECOVERY.DATE} {EVENT.RECOVERY.TIME}
{EVENT.RECOVERY.STATUS}
-
Three: zabbix 2.4 configuration
Similarly, if it is zabbix version 2.4, it is not possible to enter golong script parameters directly on the web. We can write a shell parameter in a robot-like way and call the shell in the alarm medium.
#! / bin/bash
Agentid=7947xxxxxx
Corpid=dingd6757axxxxxxxxx
Corpsecret=xxxxxxxxxx
To=manager56xxxxxxx
/ zabbix/share/zabbix/alertscripts/golang-zabbix-alter-to-dingding.exe-agentid=$agentid-corpid=$corpid-corpsecret=$corpsecret-to=$to-msg= "$5"
You can also create multiple alarm media and create multiple steps in the action to achieve message grading.
For example:
1-10 messages are only sent to the operation and maintenance staff, and 11 messages are also sent to the operation and maintenance supervisor at the beginning.
Some kind of message should be sent to DBA as well as to the operation and maintenance staff.
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.
Continue with the installation of the previous hadoop.First, install zookooper1. Decompress zookoope
"Every 5-10 years, there's a rare product, a really special, very unusual product that's the most un
© 2024 shulou.com SLNews company. All rights reserved.