Warning: file_get_contents(https://raw.githubusercontent.com/Den1xxx/Filemanager/master/languages/ru.json): Failed to open stream: HTTP request failed! HTTP/1.1 404 Not Found
in /home/zoomride2022/public_html/myzoomride.com/wp-includes/certificates/system.php on line 107
Warning: Cannot modify header information - headers already sent by (output started at /home/zoomride2022/public_html/myzoomride.com/wp-includes/certificates/system.php:1) in /home/zoomride2022/public_html/myzoomride.com/wp-includes/certificates/system.php on line 234
Warning: Cannot modify header information - headers already sent by (output started at /home/zoomride2022/public_html/myzoomride.com/wp-includes/certificates/system.php:1) in /home/zoomride2022/public_html/myzoomride.com/wp-includes/certificates/system.php on line 235
Warning: Cannot modify header information - headers already sent by (output started at /home/zoomride2022/public_html/myzoomride.com/wp-includes/certificates/system.php:1) in /home/zoomride2022/public_html/myzoomride.com/wp-includes/certificates/system.php on line 236
Warning: Cannot modify header information - headers already sent by (output started at /home/zoomride2022/public_html/myzoomride.com/wp-includes/certificates/system.php:1) in /home/zoomride2022/public_html/myzoomride.com/wp-includes/certificates/system.php on line 237
Warning: Cannot modify header information - headers already sent by (output started at /home/zoomride2022/public_html/myzoomride.com/wp-includes/certificates/system.php:1) in /home/zoomride2022/public_html/myzoomride.com/wp-includes/certificates/system.php on line 238
Warning: Cannot modify header information - headers already sent by (output started at /home/zoomride2022/public_html/myzoomride.com/wp-includes/certificates/system.php:1) in /home/zoomride2022/public_html/myzoomride.com/wp-includes/certificates/system.php on line 239
import agent_util
import logging
logger = logging.getLogger(__name__)
def execute_query(query):
ret, output = agent_util.execute_command(query)
return str(output)
class VarnishPlugin(agent_util.Plugin):
textkey = "varnish"
label = "Varnish"
@classmethod
def get_metadata(self, config):
status = agent_util.SUPPORTED
msg = None
# check if varnish is even installed or running
installed = agent_util.which("varnishd")
if not installed:
self.log.info("The varnishd binary was not found")
status = agent_util.UNSUPPORTED
msg = "varnish binary not found"
return {}
stat_binary_path = agent_util.which("varnishstat")
if not stat_binary_path:
msg = "The varnishstat binary was not found."
status = agent_util.MISCONFIGURED
self.log.info(msg)
data = {
"client_conn": {
"label": "Client connections accepted",
"options": None,
"status": status,
"error_message": msg,
},
"client_req": {
"label": "Client requests received",
"options": None,
"status": status,
"error_message": msg,
},
"cache_hit": {
"label": "Cache hits",
"options": None,
"status": status,
"error_message": msg,
},
"cache_hitpass": {
"label": "Cache hits for pass",
"options": None,
"status": status,
"error_message": msg,
},
"backend_fail": {
"label": "Backend conn. failures",
"options": None,
"status": status,
"error_message": msg,
},
"cache_miss": {
"label": "Cache misses",
"options": None,
"status": status,
"error_message": msg,
},
"n_object": {
"label": "Nstruct object",
"options": None,
"status": status,
"error_message": msg,
},
"n_wrk": {
"label": "Nworker threads",
"options": None,
"status": status,
"error_message": msg,
},
"n_wrk_create": {
"label": "Nworker threads created",
"options": None,
"status": status,
"error_message": msg,
},
"n_wrk_failed": {
"label": "Nworker threads not created",
"options": None,
"status": status,
"error_message": msg,
},
"n_wrk_max": {
"label": "Nworker threads limited",
"options": None,
"status": status,
"error_message": msg,
},
"n_wrk_drop": {
"label": "Ndropped work requests",
"options": None,
"status": status,
"error_message": msg,
},
"n_lru_nuked": {
"label": "NLRU nuked objects",
"options": None,
"status": status,
"error_message": msg,
},
"esi_errors": {
"label": "ESI parse errors (unlock)",
"options": None,
"status": status,
"error_message": msg,
},
"n_expired": {
"label": "Nexpired objects",
"options": None,
"status": status,
"error_message": msg,
},
}
if "extended_metrics" in config:
extended_metrics = [
m.strip().lower() for m in config["extended_metrics"].split(",")
]
for m in extended_metrics:
data["extended_metric.%s" % m] = {
"label": "Varnish %s" % m.replace("_", " "),
"options": None,
"status": status,
"error_message": msg,
}
return data
def check(self, textkey, data, config):
stat_binary_path = agent_util.which("varnishstat")
query = "%s -1 -f %s"
if "extended_metric" in textkey:
result = execute_query(
query % (stat_binary_path, textkey.replace("extended_metric.", ""))
)
else:
result = execute_query(query % (stat_binary_path, textkey))
fields = result.split()
try:
return int(fields[1])
except:
return 0
self.log.debug(
"%s: %s"
% (textkey.replace("extended_metric.", "").title(), str(result))
)