Hackfut Security File Manager
Current Path:
/usr/local/lib/python3.6/site-packages/agent360/plugins
usr
/
local
/
lib
/
python3.6
/
site-packages
/
agent360
/
plugins
/
📁
..
📄
__init__.py
(0 B)
📁
__pycache__
📄
apt-updates.py
(1.23 KB)
📄
asterisk.py
(1012 B)
📄
bind.py
(732 B)
📄
bird.py
(841 B)
📄
bitninja.py
(1.27 KB)
📄
cloudlinux-dbgov.py
(1.04 KB)
📄
cloudlinux.py
(1020 B)
📄
cpanel.py
(1.41 KB)
📄
cpu.py
(1.97 KB)
📄
cpu_freq.py
(583 B)
📄
dirsize.py
(617 B)
📄
diskinodes.py
(652 B)
📄
diskstatus-nvme.py
(1.58 KB)
📄
diskstatus.py
(1.96 KB)
📄
diskusage.py
(4.04 KB)
📄
docker.py
(3.36 KB)
📄
dovecot.py
(1.27 KB)
📄
elasticsearch.py
(4.24 KB)
📄
exim.py
(484 B)
📄
fail2ban.py
(831 B)
📄
gpu.py
(959 B)
📄
haproxy.py
(4.17 KB)
📄
httpd.py
(2.73 KB)
📄
iostat.py
(5.1 KB)
📄
janus.py
(705 B)
📄
kamailio.py
(556 B)
📄
litespeed.py
(3.04 KB)
📄
loadavg.py
(332 B)
📄
loggedin.py
(400 B)
📄
mailq.py
(528 B)
📄
mdstat.py
(1.36 KB)
📄
megacli.py
(2.72 KB)
📄
memcached.py
(3.09 KB)
📄
memory.py
(932 B)
📄
minecraft.py
(2.35 KB)
📄
mongodb.py
(5.63 KB)
📄
mysql.py
(5.13 KB)
📄
network.py
(2.72 KB)
📄
nginx.py
(3.2 KB)
📄
openvpn.py
(2.17 KB)
📄
phpfpm.py
(2.72 KB)
📄
ping.py
(3.09 KB)
📄
plesk-cgroups.py
(6.18 KB)
📄
plugins.py
(2.48 KB)
📄
postfix.py
(1.73 KB)
📄
powerdns.py
(4.56 KB)
📄
process.py
(4.26 KB)
📄
proftpd.py
(1.1 KB)
📄
rabbitmq.py
(3.49 KB)
📄
redis_stat.py
(5.48 KB)
📄
sleeper.py
(244 B)
📄
swap.py
(364 B)
📄
system.py
(5.67 KB)
📄
tcpports.py
(1.08 KB)
📄
temp.py
(1.45 KB)
📄
unbound.py
(3.24 KB)
📄
vms.py
(6.2 KB)
📄
wp-toolkit.py
(1.8 KB)
📄
yum-updates.py
(810 B)
Editing: docker.py
#!/usr/bin/env python # -*- coding: utf-8 -*- import os import plugins import time class Plugin(plugins.BasePlugin): __name__ = 'docker' def run(self, config): ''' Docker monitoring, needs sudo access! Instructions at: https://docs.360monitoring.com/docs/docker-plugin ''' containers = {} last_value = {} prev_cache = self.get_agent_cache() # Get absolute values from previous check try: lines = [s.split(' / ') for s in os.popen('sudo docker stats --no-stream --no-trunc --format "{{.CPUPerc}} / {{.Name}} / {{.ID}} / {{.MemUsage}} / {{.NetIO}} / {{.BlockIO}} / {{.MemPerc}}"').read().splitlines()] for row in lines: container = {} container['cpu'] = row[0].strip('%') name = row[1] container_id = row[2] container['mem_usage_bytes'] = self.computerReadable(row[3]) container['mem_total_bytes'] = self.computerReadable(row[4]) container['net_in_bytes'] = self.absolute_to_per_second('%s_%s' % (name, 'net_in_bytes'), self.computerReadable(row[5]), prev_cache) container['net_out_bytes'] = self.absolute_to_per_second('%s_%s' % (name, 'net_out_bytes'), self.computerReadable(row[6]), prev_cache) container['disk_in_bytes'] = self.absolute_to_per_second('%s_%s' % (name, 'disk_in_bytes'), self.computerReadable(row[7]), prev_cache) container['disk_out_bytes'] = self.absolute_to_per_second('%s_%s' % (name, 'disk_out_bytes'), self.computerReadable(row[8]), prev_cache) container['mem_pct'] = row[9].strip('%') last_value['%s_%s' % (name, 'mem_usage_bytes')] = self.computerReadable(row[3]) last_value['%s_%s' % (name, 'net_in_bytes')] = self.computerReadable(row[5]) last_value['%s_%s' % (name, 'net_out_bytes')] = self.computerReadable(row[6]) last_value['%s_%s' % (name, 'disk_in_bytes')] = self.computerReadable(row[7]) last_value['%s_%s' % (name, 'disk_out_bytes')] = self.computerReadable(row[8]) containers[name] = container except Exception as e: return e.message containers['containers'] = len(containers) last_value['ts'] = time.time() self.set_agent_cache(last_value) return containers def computerReadable(self, value): if value[-3:] == 'KiB': return float(value[:-3])*1024 elif value[-3:] == 'MiB': return float(value[:-3])*1024*1024 elif value[-3:] == 'GiB': return float(value[:-3])*1024*1024*1024 elif value[-3:] == 'TiB': return float(value[:-3])*1024*1024*1024*1024 elif value[-3:] == 'PiB': return float(value[:-3])*1024*1024*1024*1024*1024 elif value[-2:] == 'kB': return float(value[:-2])*1024 elif value[-2:] == 'MB': return float(value[:-2])*1024*1024 elif value[-2:] == 'GB': return float(value[:-2])*1024*1024*1024 elif value[-2:] == 'TB': return float(value[:-2])*1024*1024*1024*1024 elif value[-2:] == 'PB': return float(value[:-2])*1024*1024*1024*1024*1024 elif value[-1:] == 'B': return float(value[:-1]) if __name__ == '__main__': Plugin().execute()
Upload File
Create Folder