Skip to content
Projects
Groups
Snippets
Help
Loading...
Sign in
Toggle navigation
C
common_scripy
Project
Project
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
吴升宇
common_scripy
Commits
ac5dffe6
Commit
ac5dffe6
authored
Feb 07, 2021
by
吴升宇
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
update bug
parent
df7a160f
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
3 additions
and
4 deletions
+3
-4
data_sync_alert.py
scripies/data_sync_alert.py
+3
-4
No files found.
scripies/data_sync_alert.py
View file @
ac5dffe6
...
...
@@ -22,7 +22,7 @@ DATABASES = {
def
main
():
slave
=
DATABASES
[
"slave"
]
my_db
=
pymysql
.
connect
(
slave
[
"HOST"
],
slave
[
"USER"
],
slave
[
"PASSWORD"
],
slave
[
"NAME"
])
my_db
=
pymysql
.
connect
(
host
=
slave
[
"HOST"
],
user
=
slave
[
"USER"
],
passwd
=
slave
[
"PASSWORD"
],
db
=
slave
[
"NAME"
])
pg_db
=
psycopg2
.
connect
(
host
=
"172.16.50.153"
,
user
=
"brain_worker"
,
password
=
"zbVas87dtLhY"
,
database
=
"brain"
)
my_cursor
=
my_db
.
cursor
()
...
...
@@ -55,13 +55,12 @@ def main():
print
(
table
,
my_num
,
pg_num
)
if
my_num
>
pg_num
:
msg
+=
"表zhengxing.
%
s延迟的数据量为
%
s条记录, mysql:
%
s, psql:
%
s
"
.
format
(
table
,
my_num
-
pg_num
,
my_num
,
pg_num
)
msg
+=
"表zhengxing.
{}延迟的数据量为{}条记录, mysql: {}, psql: {}
"
.
format
(
table
,
my_num
-
pg_num
,
my_num
,
pg_num
)
webhook
=
'https://oapi.dingtalk.com/robot/send?access_token={}'
.
format
(
"1475fb9e6beff63126fef5464a378b6b77fa8655933a407d8159a2a2b1b8c869"
)
xiaoding
=
DingtalkChatbot
(
webhook
)
# at_mobiles = ["17794411132", "15624986543"]
at_mobiles
=
[]
at_mobiles
=
[
"17794411132"
,
"15624986543"
]
xiaoding
.
send_text
(
msg
=
msg
,
at_mobiles
=
at_mobiles
)
...
...
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