直接贴代码
用到的方法,就是 count 默认是从0开始,到最后结束
https://www.runoob.com/python/att-string-count.html
#线上慢sql报警提示
def check_mansql():
today_url="http://10.1.21.104/index.php"
#history_url="http://10.1.21.104/index.php?begin=2020-08-10"
response=requests.request("get",url=today_url,verify=False)
list=["booking_avatar","registration_avatar","cooperation_avatar","patientsignin_avatar","exhibition_avatar","evection_avatar","cosmetology_avatar","sickmanage_avatar","comment_avatar"]
list_sql=[]
for i in range(0,len(list)):
a=list[i]
a_counts=response.text.count(a)
if a_counts > 1:
mansqltixing=a+"有线上慢sql,链接:http://10.1.21.104"+" "
list_sql.append(mansqltixing)
content = "".join(list_sql)
mentioned_mobile_list = ['18210466329']
send_rebot(msgtype="text", content=content, mentioned_mobile_list=mentioned_mobile_list)