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: powerdns.py
#!/usr/bin/env python # -*- coding: utf-8 -*- try: from urllib.request import urlopen, Request except ImportError: from urllib2 import urlopen, Request import time import plugins import urllib2 import json class Plugin(plugins.BasePlugin): __name__ = 'powerdns' def run(self, config): ''' Experimental plugin for PowerDNS authoritative server. Might also work with PowerDNS recursor, but it may need extra delta_keys / absolute_keys. Add to /etc/agent360.ini: [powerdns] enabled=yes statistics_url=http://localhost:8081/api/v1/servers/localhost/statistics api_key=changeme ;ca_file= ;ca_path= ;timeout=10 ''' # Create request to configured URL request = urllib2.Request(config.get(__name__, 'statistics_url'), headers={'X-API-Key': '%s' % config.get(__name__, 'api_key')}) # defaults timeout = 10 results = dict() raw_response = None # next / previous cached metrics (for calculating deltas) next_cache = dict() prev_cache = self.get_agent_cache() # use timeout from config if specified if config.has_option(__name__, 'timeout'): timeout = int(config.get(__name__, 'timeout')) # create response based on configuration if config.has_option(__name__, 'ca_file'): raw_response = urllib2.urlopen(request, timeout=timeout, cafile=config.get(__name__, 'ca_file')) elif config.has_option(__name__, 'ca_path'): raw_response = urllib2.urlopen(request, timeout=timeout, capath=config.get(__name__, 'ca_path')) else: raw_response = urllib2.urlopen(request, timeout=timeout) # set next_cache timestamp next_cache['ts'] = time.time() # parse raw response as JSON try: stats = json.loads(raw_response.read()) except Exception: return False # keys for which we should calculate the delta delta_keys = ( 'corrupt-packets', 'deferred-cache-inserts', 'deferred-cache-lookup', 'deferred-packetcache-inserts', 'deferred-packetcache-lookup', 'dnsupdate-answers', 'dnsupdate-changes', 'dnsupdate-queries', 'dnsupdate-refused', 'incoming-notifications', 'overload-drops', 'packetcache-hit', 'packetcache-miss', 'query-cache-hit', 'query-cache-miss', 'rd-queries', 'recursing-answers', 'recursing-questions', 'recursion-unanswered', 'servfail-packets', 'signatures', 'sys-msec', 'tcp-answers', 'tcp-answers-bytes', 'tcp-queries', 'tcp4-answers', 'tcp4-answers-bytes', 'tcp4-queries', 'tcp6-answers', 'tcp6-answers-bytes', 'tcp6-queries', 'timedout-packets', 'udp-answers', 'udp-answers-bytes', 'udp-do-queries', 'udp-in-errors', 'udp-noport-errors', 'udp-queries', 'udp-recvbuf-errors', 'udp-sndbuf-errors', 'udp4-answers', 'udp4-answers-bytes', 'udp4-queries', 'udp6-answers', 'udp6-answers-bytes', 'udp6-queries', 'user-msec' ) # keys for which we should store the absolute value: absolute_keys = ( 'key-cache-size', 'latency', 'fd-usage', 'meta-cache-size', 'open-tcp-connections', 'packetcache-size', 'qsize-q', 'query-cache-size', 'real-memory-usage', 'security-status', 'signature-cache-size', 'uptime' ) data = dict() for stat in stats: if 'name' in stat and 'value' in stat and 'type' in stat: if stat['type'] == 'StatisticItem': if stat['name'] in delta_keys: results[stat['name']] = self.absolute_to_per_second(stat['name'], float(stat['value']), prev_cache) data[stat['name']] = float(stat['value']) elif stat['name'] in absolute_keys: results[stat['name']] = float(stat['value']) data['ts'] = time.time() self.set_agent_cache(data) return results if __name__ == '__main__': Plugin().execute()
SAVE FILE
TERMINAL
EXEC