From 8a7b72f7cd1ccd547a03eb4243294e741d661d3f Mon Sep 17 00:00:00 2001 From: Daniel Baumann Date: Fri, 8 Feb 2019 08:30:37 +0100 Subject: Adding upstream version 1.12.0. Signed-off-by: Daniel Baumann --- collectors/python.d.plugin/phpfpm/README.md | 3 +- collectors/python.d.plugin/phpfpm/phpfpm.chart.py | 41 ++++++++++------------- collectors/python.d.plugin/phpfpm/phpfpm.conf | 10 +++--- 3 files changed, 24 insertions(+), 30 deletions(-) (limited to 'collectors/python.d.plugin/phpfpm') diff --git a/collectors/python.d.plugin/phpfpm/README.md b/collectors/python.d.plugin/phpfpm/README.md index 66930463f..d3aa85a7c 100644 --- a/collectors/python.d.plugin/phpfpm/README.md +++ b/collectors/python.d.plugin/phpfpm/README.md @@ -32,9 +32,10 @@ priority : 90100 local: url : 'http://localhost/status' - retries : 10 ``` Without configuration, module attempts to connect to `http://localhost/status` --- + +[![analytics](https://www.google-analytics.com/collect?v=1&aip=1&t=pageview&_s=1&ds=github&dr=https%3A%2F%2Fgithub.com%2Fnetdata%2Fnetdata&dl=https%3A%2F%2Fmy-netdata.io%2Fgithub%2Fcollectors%2Fpython.d.plugin%2Fphpfpm%2FREADME&_u=MAC~&cid=5792dfd7-8dc4-476b-af31-da2fdb9f93d2&tid=UA-64295674-3)]() diff --git a/collectors/python.d.plugin/phpfpm/phpfpm.chart.py b/collectors/python.d.plugin/phpfpm/phpfpm.chart.py index a3f0963fc..70091e233 100644 --- a/collectors/python.d.plugin/phpfpm/phpfpm.chart.py +++ b/collectors/python.d.plugin/phpfpm/phpfpm.chart.py @@ -9,20 +9,8 @@ import re from bases.FrameworkServices.UrlService import UrlService -# default module values (can be overridden per job in `config`) -# update_every = 2 -priority = 60000 -retries = 60 -# default job configuration (overridden by python.d.plugin) -# config = {'local': { -# 'update_every': update_every, -# 'retries': retries, -# 'priority': priority, -# 'url': 'http://localhost/status?full&json' -# }} - -# charts order (can be overridden if you want less charts, or different order) +REGEX = re.compile(r'([a-z][a-z ]+): ([\d.]+)') POOL_INFO = [ ('active processes', 'active'), @@ -50,7 +38,14 @@ CALC = [ ('avg', average) ] -ORDER = ['connections', 'requests', 'performance', 'request_duration', 'request_cpu', 'request_mem'] +ORDER = [ + 'connections', + 'requests', + 'performance', + 'request_duration', + 'request_cpu', + 'request_mem', +] CHARTS = { 'connections': { @@ -85,7 +80,7 @@ CHARTS = { ] }, 'request_cpu': { - 'options': [None, 'PHP-FPM Request CPU', 'percent', 'request CPU', 'phpfpm.request_cpu', 'line'], + 'options': [None, 'PHP-FPM Request CPU', 'percentage', 'request CPU', 'phpfpm.request_cpu', 'line'], 'lines': [ ['minReqCpu', 'min'], ['maxReqCpu', 'max'], @@ -93,7 +88,7 @@ CHARTS = { ] }, 'request_mem': { - 'options': [None, 'PHP-FPM Request Memory', 'kilobytes', 'request memory', 'phpfpm.request_mem', 'line'], + 'options': [None, 'PHP-FPM Request Memory', 'KB', 'request memory', 'phpfpm.request_mem', 'line'], 'lines': [ ['minReqMem', 'min', 'absolute', 1, 1024], ['maxReqMem', 'max', 'absolute', 1, 1024], @@ -106,14 +101,14 @@ CHARTS = { class Service(UrlService): def __init__(self, configuration=None, name=None): UrlService.__init__(self, configuration=configuration, name=name) - self.url = self.configuration.get('url', 'http://localhost/status?full&json') self.order = ORDER self.definitions = CHARTS - self.regex = re.compile(r'([a-z][a-z ]+): ([\d.]+)') + self.url = self.configuration.get('url', 'http://localhost/status?full&json') self.json = '&json' in self.url or '?json' in self.url self.json_full = self.url.endswith(('?full&json', '?json&full')) - self.if_all_processes_running = dict([(c_name + p_name, 0) for c_name, func in CALC - for metric, p_name in PER_PROCESS_INFO]) + self.if_all_processes_running = dict( + [(c_name + p_name, 0) for c_name, func in CALC for metric, p_name in PER_PROCESS_INFO] + ) def _get_data(self): """ @@ -124,7 +119,7 @@ class Service(UrlService): if not raw: return None - raw_json = parse_raw_data_(is_json=self.json, regex=self.regex, raw_data=raw) + raw_json = parse_raw_data_(is_json=self.json, raw_data=raw) # Per Pool info: active connections, requests and performance charts to_netdata = fetch_data_(raw_data=raw_json, metrics_list=POOL_INFO) @@ -160,7 +155,7 @@ def fetch_data_(raw_data, metrics_list, pid=''): return result -def parse_raw_data_(is_json, regex, raw_data): +def parse_raw_data_(is_json, raw_data): """ :param is_json: bool :param regex: compiled regular expr @@ -174,4 +169,4 @@ def parse_raw_data_(is_json, regex, raw_data): return dict() else: raw_data = ' '.join(raw_data.split()) - return dict(regex.findall(raw_data)) + return dict(REGEX.findall(raw_data)) diff --git a/collectors/python.d.plugin/phpfpm/phpfpm.conf b/collectors/python.d.plugin/phpfpm/phpfpm.conf index 571eb9156..d31853903 100644 --- a/collectors/python.d.plugin/phpfpm/phpfpm.conf +++ b/collectors/python.d.plugin/phpfpm/phpfpm.conf @@ -27,11 +27,9 @@ # If unset, the default for python.d.plugin is used. # priority: 60000 -# retries sets the number of retries to be made in case of failures. -# If unset, the default for python.d.plugin is used. -# Attempts to restore the service are made once every update_every -# and only if the module has collected values in the past. -# retries: 60 +# penalty indicates whether to apply penalty to update_every in case of failures. +# Penalty will increase every 5 failed updates in a row. Maximum penalty is 10 minutes. +# penalty: yes # autodetection_retry sets the job re-check interval in seconds. # The job is not deleted if check fails. @@ -58,7 +56,7 @@ # # JOBs sharing a name are mutually exclusive # update_every: 1 # the JOB's data collection frequency # priority: 60000 # the JOB's order on the dashboard -# retries: 60 # the JOB's number of restoration attempts +# penalty: yes # the JOB's penalty # autodetection_retry: 0 # the JOB's re-check interval in seconds # # Additionally to the above, PHP-FPM also supports the following: -- cgit v1.2.3