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: nginx.py
#!/usr/bin/env python # -*- coding: utf-8 -*- # import psutil try: from urllib.parse import urlparse, urlencode from urllib.request import urlopen, Request from urllib.error import HTTPError except ImportError: from urlparse import urlparse from urllib import urlencode from urllib2 import urlopen, Request, HTTPError import time import plugins class Plugin(plugins.BasePlugin): __name__ = 'nginx' def run(self, config): ''' Provides the following metrics (example): "accepts": 588462, "accepts_per_second": 0.0, "active_connections": 192, "handled": 588462, "handled_per_second": 0.0, "reading": 0, "requests": 9637106, "requests_per_second": 0.0, "waiting": 189, "writing": 3 requests, accepts, handled are values since the start of nginx. *_per_second values calculated from them using cached values from previous call. ''' try: results = dict() next_cache = dict() # request = urllib2.Request(config.get('nginx', 'status_page_url')) # raw_response = urllib2.urlopen(request) next_cache['ts'] = time.time() prev_cache = self.get_agent_cache() # Get absolute values from previous check # response = raw_response.readlines() request = Request(config.get('nginx', 'status_page_url')) response = urlopen(request).read().decode('utf-8').split("\n") # Active connections: N # active_connections = response[0].split(':')[1].strip() active_connections = response[0].split()[-1] results['active_connections'] = int(active_connections) # server accepts handled requests keys = response[1].split()[1:] values = response[2].split() for key, value in zip(keys, values): next_cache[key] = int(value) results[key] = next_cache[key] # Keep absolute values in results try: if next_cache[key] >= prev_cache[key]: results['%s_per_second' % key] = \ (next_cache[key] - prev_cache[key]) / \ (next_cache['ts'] - prev_cache['ts']) else: # Nginx was restarted after previous caching results['%s_per_second' % key] = \ next_cache[key] / \ (next_cache['ts'] - prev_cache['ts']) except KeyError: # No cache yet, can't calculate results['%s_per_second' % key] = 0.0 # Reading: X Writing: Y Waiting: Z keys = response[3].split()[0::2] keys = [entry.strip(':').lower() for entry in keys] values = response[3].split()[1::2] for key, value in zip(keys, values): results[key] = int(value) # Cache absolute values for next check calculations self.set_agent_cache(next_cache) return results except Exception: return False if __name__ == '__main__': Plugin().execute()
Upload File
Create Folder