-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathupdate_to_wechat.sh
More file actions
executable file
·43 lines (37 loc) · 1.37 KB
/
update_to_wechat.sh
File metadata and controls
executable file
·43 lines (37 loc) · 1.37 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
#!/bin/bash
#---------------------------------------------------------------#
# ScriptsName: update_to_wechat.sh #
# ScriptsPath:/github/scripts/update_to_wechat.sh #
# Purpose: zabbix monitor item status push to Wechat #
# Edition: 1.0 #
# CreateDate:2016-06-16 13:31 #
# Author: Payne Zheng <zzuai520@live.com> #
#---------------------------------------------------------------#
Apicall() {
local GroupName Msg Apiurl
GroupName=$1
Msg=$2
Apiurl="http://push.plcdn.net:7890/20160128"
curl -H "To:$GroupName" "$Apiurl" -d "$Msg"
}
Status=$(awk '/^Trigger status:/{print $NF}' <<< "$3")
Body1=$(awk '/^Trigger:/{print $2}' <<< "$3")
Body2=$(awk '/^Trigger:/{print $NF}' <<< "$3")
if [ "$Status" = OK ]; then
Title="Angel"
else
Title="Belial"
fi
Msg=$(echo -e "ZABBIX:\n $Title\n $Body1\n $Body2\n $Time")
Time=$(date "+%Y-%H-%d %M:%m:%S")
Apicall PLCDN-SUPPORT "$Msg"
# $2 --> OK/PROBLEM: 江苏吴江-61.155.137.219-下载 ping_unreachable
# $3
# Trigger: 江苏吴江-61.155.137.219-下载 ping_unreachable
# Trigger status: OK
# Trigger severity: Disaster
# Trigger URL:
# IP: 61.155.137.219
# Item values:
# 1. ICMP ping (江苏吴江-61.155.137.219-下载:icmpping): Up (1)
# Original event ID: 7492264