1 Star 0 Fork 111

chenjs/MySQLMTOP

forked from 茹憶/MySQLMTOP 
加入 Gitee
与超过 1200万 开发者一起发现、参与优秀开源项目,私有仓库也完全免费 :)
免费加入
文件
克隆/下载
check_linux_resource.py 1.10 KB
一键复制 编辑 原始数据 按行查看 历史
ruzuojun 提交于 2017-07-28 15:36 . 代码目录结构重新调整和优化
#!//bin/env python
#coding:utf-8
import os
import sys
import string
import time
import datetime
import MySQLdb
import global_functions as func
from multiprocessing import Process;
def check_server_resource(ip):
command="./check_linux_resource.sh"
os.system("%s %s"%(command,ip))
def main():
func.mysql_exec("insert into linux_resource_history select * from linux_resource",'')
func.mysql_exec("delete from linux_resource",'')
linux_servers_ip = func.get_config('linux_server','server_ip')
servers=linux_servers_ip.split("|")
if servers:
print("%s: check_server_resource controller started." % (time.strftime('%Y-%m-%d %H:%M:%S', time.localtime()),));
plist = []
for ip in servers:
if ip <> '':
print ip
p = Process(target = check_server_resource, args=(ip,))
plist.append(p)
p.start()
for p in plist:
p.join()
print("%s: check_server_resource controller finished." % (time.strftime('%Y-%m-%d %H:%M:%S', time.localtime()),))
if __name__=='__main__':
main()
马建仓 AI 助手
尝试更多
代码解读
代码找茬
代码优化
Python
1
https://gitee.com/chenjs50224274/MySQLMTOP.git
git@gitee.com:chenjs50224274/MySQLMTOP.git
chenjs50224274
MySQLMTOP
MySQLMTOP
master

搜索帮助