Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
M
monitor
Project
Overview
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
zhaihuitao
monitor
Commits
bf23619b
Commit
bf23619b
authored
Mar 04, 2021
by
zhaihuitao
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
update
parent
1e7e4fbb
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
68 additions
and
12 deletions
+68
-12
getData.py
dbConfig/getData.py
+64
-11
main.py
dbConfig/main.py
+4
-1
No files found.
dbConfig/getData.py
View file @
bf23619b
...
...
@@ -20,11 +20,20 @@ username = "rytestalarm"
# password = "reyun.123"
password
=
"rytestalarm234"
db
=
"tkio_stream"
sql
=
"select num_click from tkio_rpt_source_analysis_day where appid ='b563860ef7f3400a5fe7c0a05f4523e6' and "
\
sql0
=
"select num_click from tkio_rpt_source_analysis_day where appid ='4179a8313ce1d97c4902185ae27acd09' and "
\
"dt=DATE_FORMAT((date_add(now(), interval 8 hour)),'
%
Y-
%
m-
%
d');"
sql1
=
"select num_click from tkio_rpt_source_analysis_day where appid ='8cc42034819e6e4f76b4c0252c029bda' and "
\
"dt=DATE_FORMAT((date_add(now(), interval 8 hour)),'
%
Y-
%
m-
%
d');"
sql2
=
"select num_click from tkio_rpt_source_analysis_day where appid ='1a50c64d2fcb85b9ac3d98f792a62714' and "
\
"dt=DATE_FORMAT((date_add(now(), interval 8 hour)),'
%
Y-
%
m-
%
d');"
sql3
=
"select num_click from tkio_rpt_source_analysis_day where appid ='b563860ef7f3400a5fe7c0a05f4523e6' and "
\
"dt=DATE_FORMAT((date_add(now(), interval 8 hour)),'
%
Y-
%
m-
%
d');"
# URL = 'http://10.3.20.42:8083/tkio/Bzq2aua'
URL
=
'http://uri6.com/tkio/ziQ7Jza'
URL2
=
"http://uri6.com/tkio/MVrQVra"
URL3
=
"http://uri6.com/tkio/ziQ7Jza"
URL1
=
"http://uri6.com/tkio/uaYjiea"
URL0
=
"http://uri6.com/tkio/NfERJba"
i
=
''
.
join
(
str
(
random
.
choice
(
range
(
10
)))
for
_
in
range
(
12
))
ip
=
socket
.
inet_ntoa
(
struct
.
pack
(
'>I'
,
random
.
randint
(
1
,
0xffffffff
)))
param
=
{
...
...
@@ -34,23 +43,67 @@ param = {
}
mysqlCon
=
MysqlCon
(
host
=
host
,
username
=
username
,
password
=
password
,
db
=
db
)
r
=
mysqlCon
.
get_one
(
sql
=
sql
)
if
r
is
None
:
count
=
0
r0
=
mysqlCon
.
get_one
(
sql
=
sql0
)
if
r0
is
None
:
count0
=
0
else
:
count0
=
r0
[
0
]
# mysqlCon = MysqlCon(host=host, username=username, password=password, db=db)
r1
=
mysqlCon
.
get_one
(
sql
=
sql1
)
if
r1
is
None
:
count1
=
0
else
:
count1
=
r1
[
0
]
# mysqlCon = MysqlCon(host=host, username=username, password=password, db=db)
r2
=
mysqlCon
.
get_one
(
sql
=
sql2
)
if
r2
is
None
:
count2
=
0
else
:
count
=
r
[
0
]
count2
=
r2
[
0
]
# mysqlCon = MysqlCon(host=host, username=username, password=password, db=db)
r3
=
mysqlCon
.
get_one
(
sql
=
sql3
)
if
r3
is
None
:
count3
=
0
else
:
count3
=
r3
[
0
]
# 解决运行警告问题
requests
.
packages
.
urllib3
.
disable_warnings
()
p
=
requests
.
get
(
url
=
URL
,
params
=
param
,
timeout
=
30
,
verify
=
False
)
requests
.
adapters
.
DEFAULT_RETRIES
=
5
s
=
requests
.
session
()
s
.
keep_alive
=
False
p0
=
requests
.
get
(
url
=
URL0
,
params
=
param
,
timeout
=
30
,
verify
=
False
)
time
.
sleep
(
1
)
p1
=
requests
.
get
(
url
=
URL1
,
params
=
param
,
timeout
=
30
,
verify
=
False
)
time
.
sleep
(
1
)
p2
=
requests
.
get
(
url
=
URL2
,
params
=
param
,
timeout
=
30
,
verify
=
False
)
time
.
sleep
(
1
)
p3
=
requests
.
get
(
url
=
URL3
,
params
=
param
,
timeout
=
30
,
verify
=
False
)
time
.
sleep
(
400
)
mysqlCon
=
MysqlCon
(
host
=
host
,
username
=
username
,
password
=
password
,
db
=
db
)
r
=
mysqlCon
.
get_one
(
sql
=
sql
)
num
=
r
[
0
]
print
(
count
,
num
)
r0
=
mysqlCon
.
get_one
(
sql
=
sql0
)
num0
=
r0
[
0
]
print
(
count0
,
num0
)
r1
=
mysqlCon
.
get_one
(
sql
=
sql1
)
num1
=
r1
[
0
]
print
(
count1
,
num1
)
r2
=
mysqlCon
.
get_one
(
sql
=
sql2
)
num2
=
r2
[
0
]
print
(
count2
,
num2
)
r3
=
mysqlCon
.
get_one
(
sql
=
sql3
)
num3
=
r3
[
0
]
print
(
count3
,
num3
)
if
num
>
count
:
if
num
0
>
count0
and
num1
>
count1
and
num2
>
count2
and
num3
>
count3
:
print
(
"指标确认正常"
)
else
:
# print("指标异常,请关注")
...
...
dbConfig/main.py
View file @
bf23619b
...
...
@@ -12,9 +12,12 @@ db = "tkio_stream"
sql
=
"select num_click from tkio_rpt_source_analysis_day where appid ='b563860ef7f3400a5fe7c0a05f4523e6' and "
\
"dt=curdate(); "
# mysqlCon = MysqlCon(host=host, username=username, password=password, db=db)
# r = mysqlCon.get_one(sql=sql)
# print(r)
if
4
>
3
and
4
>
2
and
3
>
4
:
print
(
"ok"
)
else
:
print
(
"no"
)
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment