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.144.42.174
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 : haproxy.py
import agent_util import os from agent_util import float import sys ###################################3 # -*- coding: utf-8 -*- import logging import socket logger = logging.getLogger(__name__) class TimeoutException(Exception): pass ################################## def get_status_headers(config): # branch logic based on socket vs http interface if "socket_cfg_file" in config: buffer = "" client = socket.socket(socket.AF_UNIX, socket.SOCK_STREAM) client.connect(config["socket_cfg_file"]) client.settimeout(2.0) out = "show stat" + "\n" client.send(out.encode("utf-8")) f = client.makefile() output = f.read().split("\n") client.close() if "stats_http_host" in config and "stats_http_port" in config and "stats_http_path" in config: auth_string = "" if "stats_http_user" in config and "stats_http_password" in config: auth_string = "%s:%s@" % (config["stats_http_user"], config["stats_http_password"]) stats_endpoint = "http://%s%s:%s/%s?stats;csv;norefresh" % (auth_string,config["stats_http_host"], config["stats_http_port"], config["stats_http_path"].replace("/", "")) ret, output = agent_util.execute_command("curl '%s'" % stats_endpoint) # extract the values from the output output = output.split("\n") header_line = output[0].split(",") metric_values = [] for values in output[1:]: if len(header_line) == len(values.split(",")): metric_values.append(dict(zip(header_line, values.split(",")))) return metric_values, output class HAProxyPlugin(agent_util.Plugin): textkey = "haproxy" label = "HAProxy" @classmethod def get_metadata(self, config): status = agent_util.SUPPORTED msg = None # check if haproxy is installed installed = agent_util.which("haproxy") if not installed: msg = "haproxy binary not found" self.log.info(msg) status = agent_util.UNSUPPORTED return {} # if http interface is being used, check if curl is present if "stats_http_host" in config and not agent_util.which("curl", exc=False): self.log.info('curl not found!') status = agent_util.UNSUPPORTED msg = "Curl is not installed - please install" return {} # if sock interface is being used, check if we can access the file if "socket_cfg_file" in config: socket_cfg_file = config["socket_cfg_file"] if config.get("debug", False): self.log.debug("HAProxy socket file path %s" % socket_cfg_file) if not os.access(socket_cfg_file, os.W_OK): self.log.error( "Agent does not have permission to access the HAProxy socket file. Please adjust permissions." ) status = agent_util.MISCONFIGURED msg = "Agent does not have permission to access the HAProxy socket file. Please adjust permissions." return {} pxservers = set() svnames = set() try: metric_values = None output = None metric_values, output = get_status_headers(config) if config.get("debug", False): self.log.info("#####################################################") self.log.info("HAProxy command 'show stat' output:") self.log.info(output) self.log.info("#####################################################") for values in metric_values: pxname = values["# pxname"] svname = values["svname"] if svname == 'BACKEND': # We skip the Backend checks continue pxservers.add(pxname + " " + svname) except Exception: status = agent_util.MISCONFIGURED self.log.exception("Couldn't get haproxy status") self.log.info("#####################################################") self.log.info("HAProxy command 'show stat' output:") self.log.info(output) self.log.info("#####################################################") msg = "Couldn't get haproxy status, make sure haproxy is running, haproxy configuration file is valid and the status module is enabled" pxservers = list(pxservers) pxservers.sort() backend_pxservers = list(filter(lambda x: 'http_back' in x or 'BACKEND' in x, pxservers)) pxservers += ['Total Backend', 'Total Frontend'] if status is agent_util.SUPPORTED and not pxservers: status = agent_util.MISCONFIGURED msg = "No Proxy servers found." metadata = { "qcur": { "label": "Current HAProxy service queued requests ", "options": pxservers, "status": status, "error_message": msg, }, "scur": { "label": "Current HAProxy service sessions", "options": pxservers, "status": status, "error_message": msg, }, "stot": { "label": "HAProxy service sessions", "options": pxservers, "status": status, "error_message": msg, }, "stot_rate": { "label": "HAProxy service session rate", "options": pxservers, "status": status, "error_message": msg, "unit": "sessions per second", }, "bin": { "label": "Bytes In of HAProxy service", "options": pxservers, "status": status, "error_message": msg, }, "bin_rate": { "label": "Rate of Bytes In of HAProxy service", "options": pxservers, "status": status, "error_message": msg, "unit": "B/s", }, "bout": { "label": "Bytes Out of HAProxy service", "options": pxservers, "status": status, "error_message": msg, }, "bout_rate": { "label": "Rate of Bytes Out of HAProxy service", "options": pxservers, "status": status, "error_message": msg, "unit": "B/s", }, "ereq": { "label": "HAProxy service error requests", "options": pxservers, "status": status, "error_message": msg, }, "eresp": { "label": "HAProxy service response errors", "options": pxservers, "status": status, "error_message": msg, }, "econ": { "label": "HAProxy service connection errors", "options": pxservers, "status": status, "error_message": msg, }, "rate": { "label": "Sessions created per second", "options": pxservers, "status": status, "error_message": msg, }, "req_rate": { "label": "HTTP requests per second", "options": pxservers, "status": status, "error_message": msg, }, "dreq": { "label": "Requests denied due to ACL restrictions", "options": pxservers, "status": status, "error_message": msg, }, "act": { "label": "Number of HAProxy service active servers", "options": backend_pxservers, "status": status, "error_message": msg, }, "dresp": { "label": "Responses denied due to ACL restrictions", "options": pxservers, "status": status, "error_message": msg, }, "wredis": { "label": "Redispatched requests", "options": pxservers, "status": status, "error_message": msg, }, "wretr": { "label": "Connection retries", "options": pxservers, "status": status, "error_message": msg, }, "bck": { "label": "Number of HAProxy service backup servers", "options": backend_pxservers, "status": status, "error_message": msg, }, "hrsp_1xx": { "label": "http responses with 1xx code", "options": pxservers, "status": status, "error_message": msg, "unit": "req/min" }, "hrsp_2xx": { "label": "http responses with 2xx code", "options": pxservers, "status": status, "error_message": msg, "unit": "req/min" }, "hrsp_3xx": { "label": "http responses with 3xx code", "options": pxservers, "status": status, "error_message": msg, "unit": "req/min" }, "hrsp_4xx": { "label": "http responses with 4xx code", "options": pxservers, "status": status, "error_message": msg, "unit": "req/min" }, "hrsp_5xx": { "label": "http responses with 5xx code", "options": pxservers, "status": status, "error_message": msg, "unit": "req/min" }, "hrsp_other": { "label": "http responses with other codes (protocol error)", "options": pxservers, "status": status, "error_message": msg, "unit": "req/min" }, "status": { "label": "webserver status", "options": pxservers, "status": status, "error_message": msg, "unit": "boolean" } } return metadata def check(self, textkey, pxserver, config): metric_values, output = get_status_headers(config) res = 0 isRate = False cached = 0 cache = None if (textkey.endswith("_rate") and (textkey != "req_rate")) or textkey.startswith('hrsp'): isRate = True if not textkey.startswith('hrsp'): textkey = textkey.split("_")[0] self.log.debug('Cache textkey {}'.format(textkey)) cache = self.get_cache_results(textkey, "haproxy") if pxserver.startswith('Total'): # Calculate the total of all services svname = pxserver.split(' ')[-1].upper() res = 0 for metric in metric_values: if metric.get('svname') == svname: self.log.debug('Total Calc SV {} Textkey {} PX {} Val {}'.format( metric.get('svname'), textkey, metric['# pxname'], metric[textkey] )) try: if metric[textkey] == "": continue elif metric[textkey] == "UP" or metric[textkey] == "OPEN": res = 1 elif metric[textkey] == "DOWN": res = 0 else: res += int(metric[textkey]) except Exception: self.log.exception("Unable to parse metric value") else: # Checking a specific haproxy service metric. pxname = pxserver[: pxserver.rfind(" " + pxserver.split(" ")[-1])] svname = pxserver.split(" ")[-1] for metric in metric_values: self.log.debug("Metric value: %s " % metric[textkey]) if pxname == metric["# pxname"] and svname == metric["svname"]: res = metric[textkey] if metric[textkey] in ('UP', 'OPEN'): res = 1 elif 'DOWN' == metric[textkey]: res = 0 else: try: res = int(res) except: return None if isRate is True: self.cache_result(textkey, "haproxy", res) if not cache: return None delta, cached_result = cache[0] if res < cached_result: return None val = (res - cached_result) / float(delta) if textkey.startswith('hrsp'): # We want actually requests per minute. val = val * 60 return val return res
Close