How to use JavaScript to issue nail alarm in zabbix 6. 0
This article introduces the knowledge of "how to use JavaScript to issue nail alarm" in zabbix 6.0. in the operation of practical cases, many people will encounter such a dilemma, so let the editor lead you to learn how to deal with these situations. I hope you can read it carefully and be able to achieve something!
Apply for nailing robot
Skip
Note that the keywords should match the alarm template
Zabbix 6.0installation
Skip
Configure nail alarm
The access_token of the nailing robot is:
Https://oapi.dingtalk.com/robot/send?access_token=123456
Type of alarm medium
Manage-- > alarm media type-- > create media type
Type selection Webhook
Parameters:
Name value comment
The string message {ALERT.MESSAGE} subject {ALERT.SUBJECT} after the access_token123456 nailing robot access_token=
Script:
Try {Zabbix.Log (4, 'params=' + value); params= JSON.parse (value); req = new CurlHttpRequest (); timest = Date.now () data = {}; result = {}; req.AddHeader ('Content-Type: application/json'); data.msgtype = "markdown" / / corresponding message parameter data.markdown = {"title": params.subject, "text": params.message.replace (/\\ nzag, "\ n"). Replace (/ awesometimestamp/g, timest)}; Zabbix.Log (4, 'markdown=' + JSON.stringify (data.markdown)); / / corresponding user parameter data.at = {"atMobiles": [], "isAtAll": "false"} / / nailing robot resp = req.Post ('https://oapi.dingtalk.com/robot/send?access_token=' + params.access_token, JSON.stringify (data));} catch (error) {} return JSON.stringify (result)
Then go to the message template
Alarm template
# xx fault alarm\ n
> alarm time: {EVENT.DATE} {EVENT.TIME}\ n
> alarm name: {EVENT.NAME}\ n
> alarm host: {HOST.NAME}\ n
> alarm level: {EVENT.SEVERITY}\ n
Restore templat
# xx alarm recovery\ n
> alarm recovery time: {EVENT.RECOVERY.DATE} {EVENT.RECOVERY.TIME}\ n
> alarm information: {EVENT.NAME}\ n
> alarm duration: {EVENT.DURATION}\ n
> alarm host: {HOST.NAME}\ n
> alarm level: {EVENT.SEVERITY}\ n
User
Manage-- > users
action
Configure-- > Action-- > Trigger actions
Create an action
Alarm display
The fault is red and the recovery is green.
This is the end of the introduction to "how to use JavaScript to issue nail alarms in zabbix 6.0. thank you for reading." If you want to know more about the industry, you can follow the website, the editor will output more high-quality practical articles for you!