GOLDEN HOUR
DIR: /usr/local/lib/python3.9/site-packages/agent360/plugins
UP
UPLOAD
Name
Size
Action
__init__.py
0 B
DEL
[ __pycache__ ]
-
DEL
apt-updates.py
1.23 KB
DEL
asterisk.py
1012 B
DEL
bind.py
732 B
DEL
bird.py
841 B
DEL
bitninja.py
1.27 KB
DEL
cloudlinux-dbgov.py
1.04 KB
DEL
cloudlinux.py
1020 B
DEL
cpanel.py
1.41 KB
DEL
cpu.py
1.97 KB
DEL
cpu_freq.py
583 B
DEL
dirsize.py
617 B
DEL
diskinodes.py
652 B
DEL
diskstatus-nvme.py
1.58 KB
DEL
diskstatus.py
1.96 KB
DEL
diskusage.py
4.04 KB
DEL
docker.py
3.36 KB
DEL
dovecot.py
1.27 KB
DEL
elasticsearch.py
4.24 KB
DEL
exim.py
484 B
DEL
fail2ban.py
831 B
DEL
gpu.py
959 B
DEL
haproxy.py
4.17 KB
DEL
httpd.py
2.73 KB
DEL
iostat.py
5.1 KB
DEL
janus.py
705 B
DEL
kamailio.py
556 B
DEL
litespeed.py
3.04 KB
DEL
loadavg.py
332 B
DEL
loggedin.py
400 B
DEL
mailq.py
528 B
DEL
mdstat.py
1.36 KB
DEL
megacli.py
2.72 KB
DEL
memcached.py
3.09 KB
DEL
memory.py
932 B
DEL
minecraft.py
2.35 KB
DEL
mongodb.py
5.63 KB
DEL
mysql.py
5.13 KB
DEL
network.py
2.72 KB
DEL
nginx.py
3.2 KB
DEL
openvpn.py
2.17 KB
DEL
phpfpm.py
2.72 KB
DEL
ping.py
3.09 KB
DEL
plesk-cgroups.py
6.18 KB
DEL
plugins.py
2.48 KB
DEL
postfix.py
1.73 KB
DEL
powerdns.py
4.56 KB
DEL
process.py
4.26 KB
DEL
proftpd.py
1.1 KB
DEL
rabbitmq.py
3.49 KB
DEL
redis_stat.py
5.48 KB
DEL
sleeper.py
244 B
DEL
swap.py
364 B
DEL
system.py
5.67 KB
DEL
tcpports.py
1.08 KB
DEL
temp.py
1.45 KB
DEL
unbound.py
3.24 KB
DEL
vms.py
6.2 KB
DEL
wp-toolkit.py
1.8 KB
DEL
yum-updates.py
810 B
DEL
Edit: diskusage.py
#!/usr/bin/env python # -*- coding: utf-8 -*- import os import psutil import plugins import json class Plugin(plugins.BasePlugin): __name__ = 'diskusage' def run(self, config): disk = {} disk['df-psutil'] = [] for part in psutil.disk_partitions(False): valid_part = True ignored_partitions = ['/loop', '/snap', 'squashfs', 'cagefs-skeleton'] for ignore in ignored_partitions: if ignore in part.device or ignore in part.mountpoint or ignore in part.fstype: valid_part = False if valid_part == False: continue if os.name == 'nt': if 'cdrom' in part.opts or part.fstype == '': # skip cd-rom drives with no disk in it; they may raise # ENOENT, pop-up a Windows GUI error for a non-ready # partition or just hang. continue try: usage = psutil.disk_usage(part.mountpoint) diskdata = {} diskdata['info'] = part for key in usage._fields: diskdata[key] = getattr(usage, key) disk['df-psutil'].append(diskdata) except: pass try: force_df = config.get('diskusage', 'force_df') except: force_df = 'no' if len(disk['df-psutil']) == 0 or force_df == 'yes': try: disk['df-psutil'] = [] df_output_lines = [s.split() for s in os.popen("df -Pl").read().splitlines()] del df_output_lines[0] for row in df_output_lines: if row[0] == 'tmpfs': continue disk['df-psutil'].append({'info': [row[0], row[5],'',''], 'total': int(row[1])*1024, 'used': int(row[2])*1024, 'free': int(row[3])*1024, 'percent': row[4][:-1]}) except: pass try: zfs_stats = config.get('diskusage', 'zfs') except: zfs_stats = 'no' if zfs_stats == 'yes': try: lines = [s.split(', ') for s in os.popen("zfs list -Hp -t volume").read().splitlines()] for row in lines: v = {} v['vg_name'] = row[0] v['vg_size'] = int(row[5][:-1]) v['vg_free'] = int(row[6][:-1]) v['vg_used'] = int(v['vg_size']-v['vg_free']) v['vg_percentage'] = (v['vg_used']/float(v['vg_size']))*100 disk['df-psutil'].append({'info': [v['vg_name'], v['vg_name'], 'zfs', False], 'total': v['vg_size'], 'used': v['vg_used'], 'free': v['vg_free'], 'percent': v['vg_percentage']}) except Exception as e: return e.message try: lvm_stats = config.get('diskusage', 'lvm') except: lvm_stats = 'no' # For LVM volume group monitoring, requires sudo access to vgs # add vgs to /etc/sudoers # agent360 ALL=(ALL) NOPASSWD: /usr/sbin/vgs # set lvm = yes right under enabled = yes in /etc/agent360.ini if lvm_stats == 'yes': try: lines = [s.split(', ') for s in os.popen("sudo vgs --all --units b --noheadings --separator ', '").read().splitlines()] for row in lines: v = {} v['vg_name'] = row[0] v['vg_size'] = int(row[5][:-1]) v['vg_free'] = int(row[6][:-1]) v['vg_used'] = int(v['vg_size']-v['vg_free']) v['vg_percentage'] = (v['vg_used']/float(v['vg_size']))*100 disk['df-psutil'].append({'info': [v['vg_name'], v['vg_name'], 'lvm', False], 'total': v['vg_size'], 'used': v['vg_used'], 'free': v['vg_free'], 'percent': v['vg_percentage']}) except Exception as e: return e.message return disk if __name__ == '__main__': Plugin().execute()
SAVE FILE
TERMINAL
EXEC