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: mysql.py
#!/usr/bin/env python # -*- coding: utf-8 -*- import time import MySQLdb import plugins class Plugin(plugins.BasePlugin): __name__ = 'mysql' def run(self, config): ''' MySQL metrics plugin ''' prev_cache = self.get_agent_cache() # Get absolute values from previous check auth = {} try: auth['port'] = int(config.get('mysql', 'port')) except ValueError: auth['port'] = 3306 try: auth['user'] = config.get('mysql', 'username') except: auth['user'] = 'root' try: auth['passwd'] = config.get('mysql', 'password') except: auth['passwd'] = '' try: auth['host'] = config.get('mysql', 'host') except: auth['unix_socket'] = config.get('mysql', 'socket') try: auth['db'] = config.get('mysql', 'database') except: auth['db'] = 'mysql' db = MySQLdb.connect(**auth) cursor = db.cursor() cursor.execute("SHOW GLOBAL STATUS;") query_result = cursor.fetchall() non_delta = ( 'max_used_connections', 'open_files', 'open_tables', 'qcache_free_blocks', 'qcache_free_memory', 'qcache_total_blocks', 'slave_open_temp_tables', 'threads_cached', 'threads_connected', 'threads_running', 'uptime' ) delta_keys = ( 'aborted_clients', 'aborted_connects', 'binlog_cache_disk_use', 'binlog_cache_use', 'bytes_received', 'bytes_sent', 'com_delete', 'com_delete_multi', 'com_insert', 'com_insert_select', 'com_load', 'com_replace', 'com_replace_select', 'com_select', 'com_update', 'com_update_multi', 'connections', 'created_tmp_disk_tables', 'created_tmp_files', 'created_tmp_tables', 'key_reads', 'key_read_requests', 'key_writes', 'key_write_requests', 'max_used_connections', 'open_files', 'open_tables', 'opened_tables', 'qcache_free_blocks', 'qcache_free_memory', 'qcache_hits', 'qcache_inserts', 'qcache_lowmem_prunes', 'qcache_not_cached', 'qcache_queries_in_cache', 'qcache_total_blocks', 'questions', 'select_full_join', 'select_full_range_join', 'select_range', 'select_range_check', 'select_scan', 'slave_open_temp_tables', 'slave_retried_transactions', 'slow_launch_threads', 'slow_queries', 'sort_range', 'sort_rows', 'sort_scan', 'table_locks_immediate', 'table_locks_waited', 'threads_cached', 'threads_connected', 'threads_created', 'threads_running' ) results = dict() data = dict() constructors = [str, float] for key, value in query_result: key = key.lower().strip() for c in constructors: try: value = c(value) except ValueError: pass if key in non_delta: results[key] = value elif key in delta_keys and type(value) is not str: results[key] = self.absolute_to_per_second(key, float(value), prev_cache) data[key] = float(value) else: pass cursor = db.cursor(MySQLdb.cursors.DictCursor) cursor.execute('SHOW SLAVE STATUS') query_result_slave = cursor.fetchone() non_delta_slave = ( 'slave_io_state', 'master_host', 'seconds_behind_master', 'read_master_log_pos', 'relay_log_pos', 'slave_io_running', 'slave_sql_running', 'last_error', 'exec_master_log_pos', 'relay_log_space', 'slave_sql_running_state', 'master_retry_count' ) if query_result_slave is None: query_result_slave = dict() for key, value in query_result_slave.items(): key = key.lower().strip() if key == 'slave_sql_running': value = 1 if value == 'Yes' else 0 if key == 'slave_io_running': value = 1 if value == 'Yes' else 0 for c in constructors: try: value = c(value) except ValueError: pass if key in non_delta_slave and type(value) is not str: results[key] = value else: pass db.close() data['ts'] = time.time() self.set_agent_cache(data) return results if __name__ == '__main__': Plugin().execute()
Upload File
Create Folder