代码拉取完成,页面将自动刷新
同步操作将从 LepusGroup/lepus 强制同步,此操作会覆盖自 Fork 仓库以来所做的任何修改,且无法恢复!!!
确定后同步将在后台操作,完成时将刷新页面,请耐心等待。
#!/bin/env python
#coding:utf-8
import os
import sys
import string
import time
import datetime
import MySQLdb
import logging
import logging.config
logging.config.fileConfig("etc/logger.ini")
logger = logging.getLogger("lepus")
path='./include'
sys.path.insert(0,path)
import functions as func
from multiprocessing import Process;
def job_run(script_name,times):
while True:
os.system("python "+script_name+".py")
time.sleep(int(times))
def main():
logger.info("lepus controller start.")
monitor = str(func.get_option('monitor'))
monitor_mysql = str(func.get_option('monitor_mysql'))
monitor_mongodb = str(func.get_option('monitor_mongodb'))
monitor_oracle = str(func.get_option('monitor_oracle'))
monitor_redis = str(func.get_option('monitor_redis'))
monitor_sqlserver = str(func.get_option('monitor_sqlserver'))
monitor_os = str(func.get_option('monitor_os'))
alarm = str(func.get_option('alarm'))
frequency_monitor = func.get_option('frequency_monitor')
frequency_monitor_alarm = int(frequency_monitor)+10
joblist = []
if monitor=="1":
if monitor_mysql=="1":
job = Process(target = job_run, args = ('check_mysql',frequency_monitor))
joblist.append(job)
job.start()
time.sleep(3)
if monitor_oracle=="1":
job = Process(target = job_run, args = ('check_oracle',frequency_monitor))
joblist.append(job)
job.start()
time.sleep(3)
if monitor_mongodb=="1":
job = Process(target = job_run, args = ('check_mongodb',frequency_monitor))
joblist.append(job)
job.start()
time.sleep(3)
if monitor_redis=="1":
job = Process(target = job_run, args = ('check_redis',frequency_monitor))
joblist.append(job)
job.start()
time.sleep(3)
if monitor_sqlserver=="1":
job = Process(target = job_run, args = ('check_sqlserver',frequency_monitor))
joblist.append(job)
job.start()
time.sleep(3)
if monitor_os=="1":
job = Process(target = job_run, args = ('check_os',frequency_monitor))
joblist.append(job)
job.start()
time.sleep(3)
if alarm=="1":
job = Process(target = job_run, args = ('alarm',frequency_monitor_alarm))
joblist.append(job)
job.start()
for job in joblist:
job.join();
logger.info("lepus controller finished.")
if __name__ == '__main__':
main()
此处可能存在不合适展示的内容,页面不予展示。您可通过相关编辑功能自查并修改。
如您确认内容无涉及 不当用语 / 纯广告导流 / 暴力 / 低俗色情 / 侵权 / 盗版 / 虚假 / 无价值内容或违法国家有关法律法规的内容,可点击提交进行申诉,我们将尽快为您处理。