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: mongodb.py
#!/usr/bin/env python import time import plugins from pymongo import MongoClient class Plugin(plugins.BasePlugin): __name__ = 'mongodb' def run(self, config): """ Mongodb monitoring """ client = MongoClient(config.get('mongodb', 'connection_string')) db = client.admin statistics = db.command("serverStatus") prev_cache = self.get_agent_cache() # Get absolute values from previous check data = {} results = {} # replication status try: results['isprimary'] = 0 if statistics['repl']['ismaster'] is False else 1 results['members'] = len(statistics['repl']['hosts']) except: pass # transactions stats, available in v3.6.3 and up try: data['transactions-retriedCommandsCount'] = statistics['transactions']['retriedCommandsCount'] data['transactions-retriedStatementsCount'] = statistics['transactions']['retriedStatementsCount'] data['transactions-transactionsCollectionWriteCount'] = statistics['transactions']['transactionsCollectionWriteCount'] data['transactions-totalAborted'] = statistics['transactions']['totalAborted'] data['transactions-totalCommitted'] = statistics['transactions']['totalCommitted'] data['transactions-totalStarted'] = statistics['transactions']['totalStarted'] results['transactions-currentActive'] = statistics['transactions']['currentActive'] results['transactions-currentInactive'] = statistics['transactions']['currentInactive'] results['transactions-currentOpen'] = statistics['transactions']['currentOpen'] except: pass data['connections.totalCreated'] = statistics['connections']['totalCreated'] results['connections.available'] = statistics['connections']['available'] results['connections.current'] = statistics['connections']['current'] data['opcounters.command'] = statistics['opcounters']['command'] data['opcounters.delete'] = statistics['opcounters']['delete'] data['opcounters.getmore'] = statistics['opcounters']['getmore'] data['opcounters.insert'] = statistics['opcounters']['insert'] data['opcounters.query'] = statistics['opcounters']['query'] data['opcounters.update'] = statistics['opcounters']['update'] data['opLatencies.commands.latency'] = statistics['opLatencies']['commands']['latency'] data['opLatencies.commands.ops'] = statistics['opLatencies']['commands']['ops'] data['opLatencies.reads.latency'] = statistics['opLatencies']['reads']['latency'] data['opLatencies.reads.ops'] = statistics['opLatencies']['reads']['ops'] data['opLatencies.writes.latency'] = statistics['opLatencies']['writes']['latency'] data['opLatencies.writes.ops'] = statistics['opLatencies']['writes']['ops'] data['globalLock.currentQueue.total'] = statistics['globalLock']['currentQueue']['total'] data['globalLock.currentQueue.readers'] = statistics['globalLock']['currentQueue']['readers'] data['globalLock.currentQueue.writers'] = statistics['globalLock']['currentQueue']['writers'] data['globalLock.activeClients.total'] = statistics['globalLock']['activeClients']['total'] data['globalLock.activeClients.readers'] = statistics['globalLock']['activeClients']['readers'] data['globalLock.activeClients.writers'] = statistics['globalLock']['activeClients']['writers'] data['asserts.msg'] = statistics['asserts']['msg'] data['asserts.regular'] = statistics['asserts']['regular'] data['asserts.rollovers'] = statistics['asserts']['rollovers'] data['asserts.user'] = statistics['asserts']['user'] data['asserts.warning'] = statistics['asserts']['warning'] #deadlock stats try: for key, val in statistics['locks'].items(): for key2, val2 in val.items(): for key3, val3 in val2.items(): data['locks-{}-{}-{}'.format(key.lower(), key2, key3)] = val3 except: pass try: data['opcountersRepl.command'] = statistics['opcountersRepl']['command'] data['opcountersRepl.delete'] = statistics['opcountersRepl']['delete'] data['opcountersRepl.getmore'] = statistics['opcountersRepl']['getmore'] data['opcountersRepl.insert'] = statistics['opcountersRepl']['insert'] data['opcountersRepl.query'] = statistics['opcountersRepl']['query'] data['opcountersRepl.update'] = statistics['opcountersRepl']['update'] except KeyError: pass for key, val in data.items(): results[key] = self.absolute_to_per_second(key, val, prev_cache) try: results['opLatencies.commands'] = results['opLatencies.commands.latency']/results['opLatencies.commands.ops'] results['opLatencies.writes'] = results['opLatencies.writes.latency']/results['opLatencies.writes.ops'] results['opLatencies.reads'] = results['opLatencies.reads.latency']/results['opLatencies.reads.ops'] except: pass next_cache = data next_cache['ts'] = time.time() self.set_agent_cache(next_cache) results['mem.resident'] = statistics['mem']['resident'] results['mem.bits'] = statistics['mem']['bits'] results['mem.virtual'] = statistics['mem']['virtual'] results['mem.supported'] = 0 if statistics['mem']['supported'] is False else 1 return results if __name__ == '__main__': Plugin().execute()
SAVE FILE
TERMINAL
EXEC