Commit 960ce1bd authored by 吴升宇's avatar 吴升宇

fix txt

parent ac5dffe6
...@@ -35,8 +35,10 @@ def main(): ...@@ -35,8 +35,10 @@ def main():
"statistic_device_user", "api_bdtransfer", "hera_bdtransfer_auto_assignor", "api_userextra", "statistic_device_user", "api_bdtransfer", "hera_bdtransfer_auto_assignor", "api_userextra",
"api_userextratocollege"] "api_userextratocollege"]
msg = "数据同步监控\n"
msg = "数据同步监控, 有{}张表在同步\n".format(len(zhengxing_table_list))
delay_table_num = 0
for table in zhengxing_table_list: for table in zhengxing_table_list:
sql = "select count(*) from %s" % table sql = "select count(*) from %s" % table
pg_sql = "select count(*) from zhengxing.%s" % table pg_sql = "select count(*) from zhengxing.%s" % table
...@@ -55,13 +57,16 @@ def main(): ...@@ -55,13 +57,16 @@ def main():
print(table, my_num, pg_num) print(table, my_num, pg_num)
if my_num > pg_num: if my_num > pg_num:
msg += "表zhengxing.{}延迟的数据量为{}条记录, mysql: {}, psql: {}".format(table, my_num - pg_num, my_num, pg_num) delay_table_num += 1
msg += "zhengxing.{}延迟的数据量为{}条记录, mysql: {}, psql: {}".format(table, my_num - pg_num, my_num, pg_num)
webhook = 'https://oapi.dingtalk.com/robot/send?access_token={}'.format( if delay_table_num > 0:
"1475fb9e6beff63126fef5464a378b6b77fa8655933a407d8159a2a2b1b8c869") msg += "有{}张表存在延迟".format(delay_table_num)
xiaoding = DingtalkChatbot(webhook) webhook = 'https://oapi.dingtalk.com/robot/send?access_token={}'.format(
at_mobiles = ["17794411132", "15624986543"] "1475fb9e6beff63126fef5464a378b6b77fa8655933a407d8159a2a2b1b8c869")
xiaoding.send_text(msg=msg, at_mobiles=at_mobiles) xiaoding = DingtalkChatbot(webhook)
at_mobiles = ["17794411132", "15624986543"]
xiaoding.send_text(msg=msg, at_mobiles=at_mobiles)
if __name__ == '__main__': if __name__ == '__main__':
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment