zabbix--python短信接口脚本
Posted
tags:
篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了zabbix--python短信接口脚本相关的知识,希望对你有一定的参考价值。
#!/usr/bin/env python
#-- coding: utf8 --
import sys
import requests
import json
def sendsms(phone, subject, message):
"""
发送短信
"""
values = {"appCode": "ZBXSZ",
"businessType": "tz",
"businessNo": "adf324",
"phoneNums": phone,
"templCode": "bqjrtzZBXSZyzryy73760",
"atTime": "null",
"paramsBody": {
"value0": subject,
"value1": message
}
}
headers = {‘Content-Type‘: ‘application/json‘}
host = ‘aps.bqjr.cn‘
post_url = ‘http://‘ + host + ‘/bqjr/msg/send‘
response = requests.post(url=post_url, headers=headers, data=json.dumps(values))
try:
req= requests.post(url=post_url, data=json.dumps(values))
print req.content
except Exception, e:
print e
if name == ‘main‘:
phone = sys.argv[1]
subject = sys.argv[2]
message = sys.argv[3]
sendsms(phone, subject, message)
以上是关于zabbix--python短信接口脚本的主要内容,如果未能解决你的问题,请参考以下文章