www.cnblogs.com/ruiyqinrui

开源、架构、Linux C/C++/python AI BI 运维开发自动化运维。 春风桃李花 秋雨梧桐叶。“力尽不知热 但惜夏日长”。夏不惜,秋不获。@ruiY--秦瑞

python爬虫,C编程,嵌入式开发.hadoop大数据,桉树,onenebula云计算架构.linux运维及驱动开发.

  博客园  :: 首页  :: 新随笔  :: 联系 :: 订阅 订阅  :: 管理

 

#!/usr/bin/env python
# -*- coding: utf-8 -*-

#++++++++++++++++++++++
#
#++++++++++++++++++++++
#运维监控预警:${time},微服务[${microsvc}]异常,请及时关注。

import requests
import json
import datetime
import os

dt = datetime.datetime.now()
print(dt)

payload={
        "accessKey":"dbc2d8,
        "accessSecret":"5d830dee4d2e6894a0707706824656",
        "c"storedValueTemplateCode":"BuliBSfO"
}
rket.juncdt.com/smartmarket/msgService/sendMessageToMulti"


#res=requests.post(url,data=json.dumps(payload))

#print(dir(res))
#print(res)

#print(res.text)

'''for i in {auth,admix,payPlatform,base,ih,cons,assets,pda};do echo http://172.uator/health/;curl -I -o /dev/null -s -w %{http_code} http://172.16.4.6:9999/$i/actuator/health/;echo "\n";done'''y:9999/base/actuator/health/")
#resCode = str(chk).split('[')[1].split(']')[0]
#print(resCode)
#print(dir(chk))
#print(chk.text)

errx = ""
#baseUrl = "http://17microSvc}/actuator/health/"
baseUrl = "http://1or/health/"
#for i in {'auth','admatform','base','ih','cons','assets','pda'}:
for i in {'auth','adm,'cons','pda'}:
#for i in {'auth','adminx','ih','cons','assets','pda'}:
        #print(i)
        endUrl = baseUrl.format(microSvc = i)
        #print(endUrl)
        x = requests.get(endUrl)
        if str(x).split('[')[1].split(']')[0] == "200":
                resOk = "服务:" + i + " 正常"
        else:
                resError  = "|服务:" + i + " 异常|"
                errx = errx + resError + ""
        #print(x)

#print(errx)
if errx == "":
        print("门诊系统正常。")
else:
        #os.system("curl \'https://qyapi application/json' -d '{"msgtype": "text","text": {"content": "测试"}}'"""")

        print("pre->门诊系统故障," + errx)
        errx2 = "pre->门诊系统故障," + errx

        os.system("curl \'http68d4de155ca\' -H \'Content-Type: application/json\' -d \'{\"msgtype\": \"text\",\"text\": {\"content\": %s}}\'"%{errx}
        #print(x)
        #os.system(x)

 

posted on 2023-09-20 17:00  秦瑞It行程实录  阅读(11)  评论(0编辑  收藏  举报
www.cnblogs.com/ruiyqinrui