def __init__(self): """类初始化""" cf = Configure() self.host = cf.read_config('server.conf', 'mysql', 'host') self.port = int(cf.read_config('server.conf', 'mysql', 'port')) self.db = cf.read_config('server.conf', 'mysql', 'database') self.user = cf.read_config('server.conf', 'mysql', 'user') self.passwd = cf.read_config('server.conf', 'mysql', 'passwd')
def __init__(self): """类初始化工作""" cf = Configure() dict = cf.read_config('strategy.conf', 'mail', 'mail') self.server = "smtp.mailgun.org" # 设置服务器 self.user = "******" # 用户名 self.passwd = "823264073" # 口令 self.mail = eval(dict) # 告警用户等级字典
def __init__(self): """类初始化""" cf = Configure() self.cpu_percent = float(cf.read_config('strategy.conf', 'cpu', 'usage')) self.svmem_precent = float(cf.read_config('strategy.conf', 'svmem', 'usage')) self.swap_precent = float(cf.read_config('strategy.conf', 'swap', 'usage')) self.diskio_precent = float(cf.read_config('strategy.conf', 'diskio', 'usage')) self.diskusage_precent = float(cf.read_config('strategy.conf', 'diskusage', 'usage')) self.netio_precent = float(cf.read_config('strategy.conf', 'netio', 'usage')) self.user = tuple(eval(cf.read_config('strategy.conf', 'user', 'user'))) self.port = tuple(eval(cf.read_config('strategy.conf', 'port', 'port')))
def __init__(self, thread_id, name): """一些类初始化工作""" threading.Thread.__init__(self) threading.threadID = thread_id threading.name = name # 读取配置文件 cf = Configure() self.host = cf.read_config('server.conf', 'server', 'host') self.port = int(cf.read_config('server.conf', 'server', 'port')) self.max_line = int(cf.read_config('server.conf', 'server', 'max_line')) self.buf_size = int(cf.read_config('server.conf', 'buffer', 'size')) # 保存历史警告数据 self.old_alarm_dict = {} self.init_alarm = { 'cpu': 0, 'svmem': 0, 'sswap': 0, 'disk_io': 0, 'disk_usage': 0, 'net_avrg': 0, 'user': 0, 'port': 0, }