Zabbix微信告警实战
企业微信地址,个人可注册https://work.weixin.qq.com/登录企业微信企业 -> 微工作台里可以直接微信关注,无需要下载企业微信通讯录里的账号在发微信脚本中要用到应用与小程序可创建应用发微信的python脚本/usr/local/zabbix/alertscripts/zabbix_wx.py#!/usr/bin/python# -*- coding: utf-8 -*-
发微信的python脚本/usr/local/zabbix/alertscripts/zabbix_wx.py
gettoken_url = 'https://qyapi.weixin.qq.com/cgi-bin/gettoken?corpid=' + corpid + '&corpsecret=' + corpsecret
token_file = urllib2.urlopen(gettoken_url)
token_data = token_file.read().decode('utf-8')
token_json = json.loads(token_data)
my_token = token_json['access_token']
touser=sys.argv[1] #many user: 'zhangsan|wangwu'
json_content = json.dumps(post_content)
url = 'https://qyapi.weixin.qq.com/cgi-bin/message/send?access_token=' + my_token
response = urllib2.urlopen(url,json_content)
print(response.read().decode('utf-8'))
/usr/local/zabbix/alertscripts/zabbix_wx.py 'zhuang_weihong' 'disk is not enough'
更多推荐
所有评论(0)