1 Star 0 Fork 12

paul008/KafkaMonitor

forked from 授客/KafkaMonitor 
加入 Gitee
与超过 1200万 开发者一起发现、参与优秀开源项目,私有仓库也完全免费 :)
免费加入
文件
克隆/下载
main.py 1.42 KB
一键复制 编辑 原始数据 按行查看 历史
授客 提交于 2019-02-20 11:36 . 文档维护
#!/usr/bin/env/ python
# -*- coding:utf-8 -*-
__author__ = 'shouke'
import sys
from kafkaMonitor import KafkaMonitor
from log import logger
if __name__ == '__main__':
logger.info('--------------------------开始运行--------------------------')
try:
logger.info('执行操作:执行性能监控')
interval, time = '1', '1'
if len(sys.argv) == 2:
interval = sys.argv[1]
elif len(sys.argv) == 3:
interval, time = sys.argv[1], sys.argv[2]
exclustion = []
if len(sys.argv) > 3:
interval, time = sys.argv[1], sys.argv[2]
exclustion = sys.argv[3:]
if interval != '1':
if not interval.isdigit():
logger.error('采样时间间隔只能为数字')
exit()
if time != '1':
temp = time.replace('+', '').replace(' ', '')
if not temp.isdigit():
print('采样持续时间只能为数字\算术表达式')
exit()
interval = int(interval)
if interval <=0:
interval = 1
time = eval(time)
if time <=0:
time = 1
count = int(time/interval)
if count <=0:
count = 1
mornitor = KafkaMonitor(interval, count)
mornitor.run()
logger.info('程序运行结束')
except Exception as e:
logger.error('运行出错:%s' % e)
Loading...
马建仓 AI 助手
尝试更多
代码解读
代码找茬
代码优化
Python
1
https://gitee.com/paul008/KafkaMonitor.git
git@gitee.com:paul008/KafkaMonitor.git
paul008
KafkaMonitor
KafkaMonitor
master

搜索帮助

0d507c66 1850385 C8b1a773 1850385