日韩久久久精品,亚洲精品久久久久久久久久久,亚洲欧美一区二区三区国产精品 ,一区二区福利

zabbix利用python實現微信報警

系統 2027 0
            
              
                #!/usr/bin/python
              
              
                # -*- coding: utf-8 -*-
              
              
                import
              
               json

              
                import
              
               sys

              
                import
              
               urllib
              
                ,
              
              urllib2

agentid 
              
                =
              
              
                '1000002'
              
              
corpid 
              
                =
              
              
                'wwcfdsgdfgdfg6f49a87b9'
              
              
corpsecret 
              
                =
              
              
                'sUEN_BhfghfghTNhfsdfhdfsgdfgsdfgY_8sGOmerno'
              
              
                #get tocken
              
              
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'
              
              
                ]
              
              
                #send wechart
              
              
touser
              
                =
              
              sys
              
                .
              
              argv
              
                [
              
              
                1
              
              
                ]
              
              
                #many user: 'zhangsan|wangwu'
              
              
content
              
                =
              
              sys
              
                .
              
              argv
              
                [
              
              
                2
              
              
                ]
              
              
                #content
              
              

post_content 
              
                =
              
              
                {
              
              
                "touser"
              
              
                :
              
              touser
              
                ,
              
              
                "agentid"
              
              
                :
              
              agentid
              
                ,
              
              
                "msgtype"
              
              
                :
              
              
                "text"
              
              
                ,
              
              
                "text"
              
              
                :
              
              
                {
              
              
                "content"
              
              
                :
              
              content
              
                ,
              
              
                }
              
              
                }
              
              
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'
              
              
                )
              
              
                )
              
            
          

zabbix 配置
zabbix利用python實現微信報警_第1張圖片


更多文章、技術交流、商務合作、聯系博主

微信掃碼或搜索:z360901061

微信掃一掃加我為好友

QQ號聯系: 360901061

您的支持是博主寫作最大的動力,如果您喜歡我的文章,感覺我的文章對您有幫助,請用微信掃描下面二維碼支持博主2元、5元、10元、20元等您想捐的金額吧,狠狠點擊下面給點支持吧,站長非常感激您!手機微信長按不能支付解決辦法:請將微信支付二維碼保存到相冊,切換到微信,然后點擊微信右上角掃一掃功能,選擇支付二維碼完成支付。

【本文對您有幫助就好】

您的支持是博主寫作最大的動力,如果您喜歡我的文章,感覺我的文章對您有幫助,請用微信掃描上面二維碼支持博主2元、5元、10元、自定義金額等您想捐的金額吧,站長會非常 感謝您的哦!!!

發表我的評論
最新評論 總共0條評論
主站蜘蛛池模板: 和田县| 霍山县| 昌宁县| 南川市| 共和县| 蒙自县| 阿荣旗| 辽宁省| 绥棱县| 汉川市| 诸城市| 柘荣县| 稻城县| 浦东新区| 平安县| 巩义市| 崇州市| 东乡族自治县| 雷波县| 宜君县| 克拉玛依市| 巴南区| 麻江县| 昌都县| 土默特右旗| 靖江市| 安乡县| 黄石市| 隆安县| 玉山县| 克东县| 常山县| 泊头市| 寻甸| 个旧市| 苏尼特右旗| 油尖旺区| 龙泉市| 泸西县| 涞源县| 保靖县|