Commit 2c0bdfaa authored by 李小芳's avatar 李小芳

修改某些队列的报警时间

parent 2eac9a1d
......@@ -20,17 +20,17 @@ token_dict = {
"graces-es6-tapir-service": {'secret': "SEC65d8ac5f9c92677cf0c98624810abc407cf433fd4f2713649dc41310b4658fb5",
'access_token': "ca4ca402653c7fe6011c18ff5ac385b2b0f4ab6cab61c545f09f4d8830db6870"},
"graces-es6-tapir-service_pre": {'secret': "SEC65d8ac5f9c92677cf0c98624810abc407cf433fd4f2713649dc41310b4658fb5",
'access_token': "ca4ca402653c7fe6011c18ff5ac385b2b0f4ab6cab61c545f09f4d8830db6870"},
'access_token': "ca4ca402653c7fe6011c18ff5ac385b2b0f4ab6cab61c545f09f4d8830db6870"},
"graces-es6-tapir-doctor": {'secret': "SEC65d8ac5f9c92677cf0c98624810abc407cf433fd4f2713649dc41310b4658fb5",
'access_token': "ca4ca402653c7fe6011c18ff5ac385b2b0f4ab6cab61c545f09f4d8830db6870"},
'access_token': "ca4ca402653c7fe6011c18ff5ac385b2b0f4ab6cab61c545f09f4d8830db6870"},
"mentha-tapir-answer": {'secret': "SECba5212dadad3794b3da51c903c828f60ab8342897af2675f1f48fceb8858eb5c",
'access_token': "df546521ce46bfb35025ca266efc2d7e8d708d1c8ada9b15ae487786ad06ad12"},
"graces-tapir-card": {'secret': "SECa54a42411200fd7c642921c35b7d0fe5a71c93e7305091413292bb6cc6cb318c",
'access_token': "9e5c7d5b6249ca1d968bbf7dc9dd9caf0f8ab4ea37b18337b33746cad5a7a5e6"},
'access_token': "9e5c7d5b6249ca1d968bbf7dc9dd9caf0f8ab4ea37b18337b33746cad5a7a5e6"},
"graces-es6-tapir-lbs": {'secret': "SECa54a42411200fd7c642921c35b7d0fe5a71c93e7305091413292bb6cc6cb318c",
'access_token': "9e5c7d5b6249ca1d968bbf7dc9dd9caf0f8ab4ea37b18337b33746cad5a7a5e6"},
'access_token': "9e5c7d5b6249ca1d968bbf7dc9dd9caf0f8ab4ea37b18337b33746cad5a7a5e6"},
"graces-es6-tapir-merchant": {'secret': "SECa54a42411200fd7c642921c35b7d0fe5a71c93e7305091413292bb6cc6cb318c",
'access_token': "9e5c7d5b6249ca1d968bbf7dc9dd9caf0f8ab4ea37b18337b33746cad5a7a5e6"},
'access_token': "9e5c7d5b6249ca1d968bbf7dc9dd9caf0f8ab4ea37b18337b33746cad5a7a5e6"},
"mentha-tapir-tractate": {'secret': "SECba5212dadad3794b3da51c903c828f60ab8342897af2675f1f48fceb8858eb5c",
'access_token': "df546521ce46bfb35025ca266efc2d7e8d708d1c8ada9b15ae487786ad06ad12"},
}
......@@ -78,37 +78,47 @@ def len_list_and_send_msg(redis_clint, key_name, rules, per_sec=10):
# print(key_name,res)
str_res = rules.parse(key_name, res, per_sec=per_sec)
if str_res:
if key_name in ["graces-tapir-card","graces-es6-tapir-lbs","graces-es6-tapir-merchant"]:
if key_name in ["graces-tapir-card", "graces-es6-tapir-lbs", "graces-es6-tapir-merchant"]:
send_msg_to_dingtalk(str_res, mobiles=["19566173658"], secret=token_dict[key_name]['secret'],
access_token=token_dict[key_name]['access_token'])
else:
send_msg_to_dingtalk(str_res,mobiles=["13552564745","17813268931"], secret=token_dict[key_name]['secret'],
send_msg_to_dingtalk(str_res, mobiles=["13552564745", "17813268931"], secret=token_dict[key_name]['secret'],
access_token=token_dict[key_name]['access_token'])
if __name__ == "__main__":
rules = Parse_data()
# 队列名和队列redis地址
redis_clicnt_dct = {
thirty_redis_clicnt_dct = {
"gaia-dbmw": redis_old_gaia,
"tapir-gaia-service": redis_old_gaia,
"mimas-dbmw": redis_old_mimas,
"graces-es6-tapir-diary": redis_new_gaia,
"mentha-tapir-answer": redis_new_mimas,
"mentha-tapir-tractate": redis_new_mimas,
"mimas-dbmw": redis_old_mimas,
"graces-es6-tapir-message": redis_new_gaia,
}
redis_clicnt_dct = {
"tapir-gaia-service": redis_old_gaia,
"graces-es6-tapir-service": redis_new_gaia,
"graces-es6-tapir-service_pre": redis_new_gaia,
"graces-es6-tapir-doctor": redis_new_gaia,
"mentha-tapir-answer": redis_new_mimas,
"graces-tapir-card":redis_new_gaia,
"graces-tapir-card": redis_new_gaia,
"graces-es6-tapir-lbs": redis_new_gaia,
"graces-es6-tapir-merchant": redis_new_gaia,
"mentha-tapir-tractate": redis_new_mimas,
}
per_sec = 60 * 5
thirty_per_sec = 60 * 30
last_time = time.time()
while True:
now = time.time()
if now - last_time >= per_sec:
for redis_clint_key in redis_clicnt_dct:
len_list_and_send_msg(redis_clicnt_dct[redis_clint_key], redis_clint_key, rules, per_sec)
last_time = now
last_time = now
if now - last_time >= thirty_per_sec:
for redis_clint_key in thirty_redis_clicnt_dct:
len_list_and_send_msg(thirty_redis_clicnt_dct[redis_clint_key], redis_clint_key, rules, thirty_per_sec)
last_time = now
time.sleep(1)
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