PATH: //proc/self/root/usr/local/lib/python3.9/site-packages/agent360/plugins
FILE_BARU
CREATE
FOLDER_BARU
MKDIR
UPLOAD_FILE
GO
[ .. KEMBALI ]
📄 __init__.py
↓
X
📁 __pycache__/
X
📄 apt-updates.py
↓
X
📄 asterisk.py
↓
X
📄 bind.py
↓
X
📄 bird.py
↓
X
📄 bitninja.py
↓
X
📄 cloudlinux-dbgov.py
↓
X
📄 cloudlinux.py
↓
X
📄 cpanel.py
↓
X
📄 cpu.py
↓
X
📄 cpu_freq.py
↓
X
📄 dirsize.py
↓
X
📄 diskinodes.py
↓
X
📄 diskstatus-nvme.py
↓
X
📄 diskstatus.py
↓
X
📄 diskusage.py
↓
X
📄 docker.py
↓
X
📄 dovecot.py
↓
X
📄 elasticsearch.py
↓
X
📄 exim.py
↓
X
📄 fail2ban.py
↓
X
📄 gpu.py
↓
X
📄 haproxy.py
↓
X
📄 httpd.py
↓
X
📄 iostat.py
↓
X
📄 janus.py
↓
X
📄 kamailio.py
↓
X
📄 litespeed.py
↓
X
📄 loadavg.py
↓
X
📄 loggedin.py
↓
X
📄 mailq.py
↓
X
📄 mdstat.py
↓
X
📄 megacli.py
↓
X
📄 memcached.py
↓
X
📄 memory.py
↓
X
📄 minecraft.py
↓
X
📄 mongodb.py
↓
X
📄 mysql.py
↓
X
📄 network.py
↓
X
📄 nginx.py
↓
X
📄 openvpn.py
↓
X
📄 phpfpm.py
↓
X
📄 ping.py
↓
X
📄 plesk-cgroups.py
↓
X
📄 plugins.py
↓
X
📄 postfix.py
↓
X
📄 powerdns.py
↓
X
📄 process.py
↓
X
📄 proftpd.py
↓
X
📄 rabbitmq.py
↓
X
📄 redis_stat.py
↓
X
📄 sleeper.py
↓
X
📄 swap.py
↓
X
📄 system.py
↓
X
📄 tcpports.py
↓
X
📄 temp.py
↓
X
📄 unbound.py
↓
X
📄 vms.py
↓
X
📄 wp-toolkit.py
↓
X
📄 yum-updates.py
↓
X
SAVING...
BERHASIL DIUBAH!
EDITING: phpfpm.py
#!/usr/bin/env python # -*- coding: utf-8 -*- #from past.builtins import basestring # pip install future 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 sys import time import plugins import json class Plugin(plugins.BasePlugin): __name__ = 'phpfpm' def run(self, config): ''' php-fpm status page metrics ''' def ascii_encode_dict(data): ascii_encode = lambda x: x.encode('ascii') if isinstance(x, unicode) else x return dict(map(ascii_encode, pair) for pair in data.items()) results = dict() next_cache = dict() my_pools = config.get(__name__, 'status_page_url').split(',') prev_cache = self.get_agent_cache() # Get absolute values from previous check for pool in my_pools: request = Request(pool) raw_response = urlopen(request) try: data = raw_response.read().decode('utf-8') # pprint.pprint(data) if sys.version_info >= (3,): j = json.loads(data) else: j = json.loads(data, object_hook=ascii_encode_dict) results[j['pool']] = {} next_cache['%s_ts' % j['pool']] = time.time() for k, v in j.items(): results[j['pool']][k.replace(" ", "_")] = v next_cache['%s_accepted_conn' % j['pool']] = int(results[j['pool']]['accepted_conn']) except Exception as e: return e try: if next_cache['%s_accepted_conn' % j['pool']] >= prev_cache['%s_accepted_conn' % j['pool']]: results[j['pool']]['accepted_conn_per_second'] = \ (next_cache['%s_accepted_conn' % j['pool']] - prev_cache['%s_accepted_conn' % j['pool']]) / \ (next_cache['%s_ts' % j['pool']] - prev_cache['%s_ts' % j['pool']]) else: # Was restarted after previous caching results[j['pool']]['accepted_conn_per_second'] = \ next_cache['%s_accepted_conn' % j['pool']] / \ (next_cache['%s_ts' % j['pool']] - prev_cache['%s_ts' % j['pool']]) except KeyError: # No cache yet, can't calculate results[j['pool']]['accepted_conn_per_second'] = 0.0 # Cache absolute values for next check calculations self.set_agent_cache(next_cache) return results if __name__ == '__main__': Plugin().execute()
SIMPAN PERUBAHAN