/
usr
/
local
/
lib
/
python3.9
/
site-packages
/
agent360
/
plugins
/
/usr/local/lib/python3.9/site-packages/agent360/plugins
mkdir
upload
Name
Size
Mode
Actions
__pycache__/
-
0755
rm
apt-updates.py
1260
0644
edit
dl
rm
asterisk.py
1012
0644
edit
dl
rm
bind.py
732
0644
edit
dl
rm
bird.py
841
0644
edit
dl
rm
bitninja.py
1302
0644
edit
dl
rm
cloudlinux-dbgov.py
1066
0644
edit
dl
rm
cloudlinux.py
1020
0644
edit
dl
rm
cpanel.py
1441
0644
edit
dl
rm
cpu.py
2020
0644
edit
dl
rm
cpu_freq.py
583
0644
edit
dl
rm
dirsize.py
617
0644
edit
dl
rm
diskinodes.py
652
0644
edit
dl
rm
diskstatus-nvme.py
1618
0644
edit
dl
rm
diskstatus.py
2005
0644
edit
dl
rm
diskusage.py
4140
0644
edit
dl
rm
docker.py
3442
0644
edit
dl
rm
dovecot.py
1304
0644
edit
dl
rm
elasticsearch.py
4342
0644
edit
dl
rm
exim.py
484
0644
edit
dl
rm
fail2ban.py
831
0644
edit
dl
rm
gpu.py
959
0644
edit
dl
rm
haproxy.py
4274
0644
edit
dl
rm
httpd.py
2800
0644
edit
dl
rm
iostat.py
5227
0644
edit
dl
rm
janus.py
705
0644
edit
dl
rm
kamailio.py
556
0644
edit
dl
rm
litespeed.py
3114
0644
edit
dl
rm
loadavg.py
332
0644
edit
dl
rm
loggedin.py
400
0644
edit
dl
rm
mailq.py
528
0644
edit
dl
rm
mdstat.py
1388
0644
edit
dl
rm
megacli.py
2787
0644
edit
dl
rm
memcached.py
3165
0644
edit
dl
rm
memory.py
932
0644
edit
dl
rm
minecraft.py
2410
0644
edit
dl
rm
mongodb.py
5766
0644
edit
dl
rm
mysql.py
5256
0644
edit
dl
rm
network.py
2786
0644
edit
dl
rm
nginx.py
3275
0644
edit
dl
rm
openvpn.py
2223
0644
edit
dl
rm
phpfpm.py
2781
0644
edit
dl
rm
ping.py
3165
0644
edit
dl
rm
plesk-cgroups.py
6330
0644
edit
dl
rm
plugins.py
2538
0644
edit
dl
rm
postfix.py
1774
0644
edit
dl
rm
powerdns.py
4669
0644
edit
dl
rm
process.py
4365
0644
edit
dl
rm
proftpd.py
1130
0644
edit
dl
rm
rabbitmq.py
3569
0644
edit
dl
rm
redis_stat.py
5615
0644
edit
dl
rm
sleeper.py
244
0644
edit
dl
rm
swap.py
364
0644
edit
dl
rm
system.py
5811
0644
edit
dl
rm
tcpports.py
1110
0644
edit
dl
rm
temp.py
1480
0644
edit
dl
rm
unbound.py
3316
0644
edit
dl
rm
vms.py
6352
0644
edit
dl
rm
wp-toolkit.py
1845
0644
edit
dl
rm
yum-updates.py
810
0644
edit
dl
rm
__init__.py
0
0644
edit
dl
rm
Edit:
/usr/local/lib/python3.9/site-packages/agent360/plugins/redis_stat.py
(5615B)
#!/usr/bin/env python # -*- coding: utf-8 -*- import plugins import redis ### Uncomment/Comment the Attribute Names to be monitored METRICS = { # Server section #"redis_version": "redis version", #"redis_git_sha1": "redis git sha1", #"redis_git_dirty": "redis git dirty", #"redis_build_id": "redis build id", #"redis_mode": "redis mode", #"os": "os", #"arch_bits": "arch bits", #"multiplexing_api": "multiplexing api", #"gcc_version": "gcc version", #"process_id": "process id", #"run_id": "run id", #"tcp_port": "tcp port", "uptime_in_seconds": "uptime", #"uptime_in_days": "uptime in days", #"hz": "hz", #"lru_clock": "lru clock", #"executable": "redis path", #"config_file": "config file", # Clients section "connected_clients": "connected clients", #"client_longest_output_list": "client longest output list", #"client_biggest_input_buf": "client biggest input buf", #"blocked_clients": "blocked clients", # Memory section "used_memory": "used memory", #"used_memory_human": "used memory human", #"used_memory_rss": "used memory rss", #"used_memory_rss_human": "used memory rss human", #"used_memory_peak": "used memory peak", "used_memory_peak_human": "used memory peak human", #"total_system_memory": "total system memory", #"total_system_memory_human": "total system memory human", #"used_memory_lua": "used memory lua", #"used_memory_lua_human": "used memory lua human", "maxmemory": "maxmemory", #"maxmemory_human": "maxmemory human", "maxmemory_policy": "maxmemory policy", #"mem_fragmentation_ratio": "mem fragmentation ratio", #"mem_allocator": "mem allocator", # Persistence section #"loading": "loading", #"rdb_changes_since_last_save": "rdb changes since last save", #"rdb_bgsave_in_progress": "rdb bgsave in progress", #"rdb_last_save_time": "rdb last save time", #"rdb_last_bgsave_status": "rdb last bgsave status", #"rdb_last_bgsave_time_sec": "rdb last bgsave time sec", #"rdb_current_bgsave_time_sec": "rdb current bgsave time sec", #"aof_enabled": "aof enabled", #"aof_rewrite_in_progress": "aof rewrite in progress", #"aof_rewrite_scheduled": "aof rewrite scheduled", #"aof_last_rewrite_time_sec": "aof last rewrite time", #"aof_current_rewrite_time_sec": "aof current rewrite time", #"aof_last_bgrewrite_status": "aof last bgrewrite status", #"aof_last_write_status": "aof last write status", #"aof_current_size": "aof current size", #"aof_base_size": "aof base size", #"aof_pending_rewrite": "aof pending rewrite", #"aof_buffer_length": "aof buffer length", #"aof_rewrite_buffer_length": "aof rewrite buffer length", #"aof_pending_bio_fsync": "aof pending bio fsync", #"aof_delayed_fsync": "aof delayed fsync", # Stats section #"total_connections_received": "total connections received", "total_commands_processed": "total commands processed", #"instantaneous_ops_per_sec": "instantaneous ops per sec", "total_net_input_bytes": "total net input bytes", "total_net_output_bytes": "total net output bytes", #"instantaneous_input_kbps": "instantaneous input kbps", #"instantaneous_output_kbps": "instantaneous output kbps", #"rejected_connections": "rejected connections", #"sync_full": "sync full", #"sync_partial_ok": "sync partial ok", #"sync_partial_err": "sync partial err", "expired_keys": "expired keys", "evicted_keys": "evicted keys", "keyspace_hits": "keyspace hits", "keyspace_misses": "keyspace misses", #"pubsub_channels": "pubsub channels", #"pubsub_patterns": "pubsub patterns", #"latest_fork_usec": "latest fork usec", #"migrate_cached_sockets": "migrate cached sockets", # Replication section #"role": "role", #"connected_slaves": "connected slaves", #"master_repl_offset": "master repl offset", #"repl_backlog_active": "repl backlog active", #"repl_backlog_size": "repl backlog size", #"repl_backlog_first_byte_offset": "repl backlog first byte offset", #"repl_backlog_histlen": "repl backlog histlen", # CPU section #"used_cpu_sys": "used cpu sys", #"used_cpu_user": "used cpu user", #"used_cpu_sys_children": "used cpu sys children", #"used_cpu_user_children": "used cpu user children", # Cluster section "cluster_enabled": "cluster enabled" } class Plugin(plugins.BasePlugin): __name__ = 'redis_stat' def run(self, config): data = {} stats = None try: redis_host = (config.get(__name__, 'host')) except: redis_host = '127.0.0.1' try: redis_port = (config.get(__name__, 'port')) except: redis_port = '6379' try: redis_db = (config.get(__name__, 'db')) except: redis_db = '0' try: redis_password = (config.get(__name__, 'password')) except: redis_password = '' try: redis_connection = redis.StrictRedis(host=redis_host,port=redis_port,db=redis_db,password=redis_password) stats = redis_connection.info() except Exception as e: data['status']=0 data['msg']='Connection Error' if not stats: return data for name, value in stats.items(): if name in METRICS.keys() : data[METRICS[name]] = value return data if __name__ == '__main__': Plugin().execute()
Save
cmd:
run