1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
# -*- coding: utf-8 -*-
import random
import requests
import time
import os,sys
import socket, struct
from dbConfig.dbConn import MysqlCon
curPath = os.path.abspath(os.path.dirname(__file__))
rootPath = os.path.split(curPath)[0]
sys.path.append(rootPath)
# host = "10.3.20.32"
host = "etl.cma5jkozme68.rds.cn-north-1.amazonaws.com.cn"
# username = "root"
username = "rytestalarm"
# password = "reyun.123"
password = "rytestalarm234"
db = "tkio_stream"
sql = "select num_click from tkio_rpt_source_analysis_day where appid ='b563860ef7f3400a5fe7c0a05f4523e6';"
# URL = 'http://10.3.20.42:8083/tkio/Bzq2aua'
URL = 'http://uri6.com/tkio/ziQ7Jza'
i = ''.join(str(random.choice(range(10))) for _ in range(12))
ip = socket.inet_ntoa(struct.pack('>I', random.randint(1, 0xffffffff)))
param = {
"imei": i,
"ip": ip,
"deviceid": i
}
mysqlCon = MysqlCon(host=host, username=username, password=password, db=db)
r = mysqlCon.get_one(sql=sql)
count = r[0]
p = requests.get(url=URL, params=param, timeout=30, verify=False)
time.sleep(360)
mysqlCon = MysqlCon(host=host, username=username, password=password, db=db)
r = mysqlCon.get_one(sql=sql)
num = r[0]
if count + 1 == num:
print("指标确认正常")
else:
print("指标异常,请关注")