diff options
author | Daniel Baumann <daniel.baumann@progress-linux.org> | 2019-02-08 07:30:37 +0000 |
---|---|---|
committer | Daniel Baumann <daniel.baumann@progress-linux.org> | 2019-02-08 07:30:37 +0000 |
commit | 8a7b72f7cd1ccd547a03eb4243294e741d661d3f (patch) | |
tree | 7bc7be4a8e9e298daa1349348400aa2a653866f2 /collectors/python.d.plugin/varnish | |
parent | New upstream version 1.11.1+dfsg (diff) | |
download | netdata-8a7b72f7cd1ccd547a03eb4243294e741d661d3f.tar.xz netdata-8a7b72f7cd1ccd547a03eb4243294e741d661d3f.zip |
Adding upstream version 1.12.0.upstream/1.12.0
Signed-off-by: Daniel Baumann <daniel.baumann@progress-linux.org>
Diffstat (limited to 'collectors/python.d.plugin/varnish')
-rw-r--r-- | collectors/python.d.plugin/varnish/README.md | 10 | ||||
-rw-r--r-- | collectors/python.d.plugin/varnish/varnish.chart.py | 34 | ||||
-rw-r--r-- | collectors/python.d.plugin/varnish/varnish.conf | 14 |
3 files changed, 39 insertions, 19 deletions
diff --git a/collectors/python.d.plugin/varnish/README.md b/collectors/python.d.plugin/varnish/README.md index 96c7cafaa..44d64efe1 100644 --- a/collectors/python.d.plugin/varnish/README.md +++ b/collectors/python.d.plugin/varnish/README.md @@ -64,6 +64,14 @@ It produces: ### configuration -No configuration is needed. +Only one parameter is supported: + +```yaml +instance_name: 'name' +``` + +The name of the varnishd instance to get logs from. If not specified, the host name is used. --- + +[![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%2Fvarnish%2FREADME&_u=MAC~&cid=5792dfd7-8dc4-476b-af31-da2fdb9f93d2&tid=UA-64295674-3)]() diff --git a/collectors/python.d.plugin/varnish/varnish.chart.py b/collectors/python.d.plugin/varnish/varnish.chart.py index d889c2b33..da6781576 100644 --- a/collectors/python.d.plugin/varnish/varnish.chart.py +++ b/collectors/python.d.plugin/varnish/varnish.chart.py @@ -8,10 +8,6 @@ import re from bases.collection import find_binary from bases.FrameworkServices.ExecutableService import ExecutableService -# default module values (can be overridden per job in `config`) -# update_every = 2 -priority = 60000 -retries = 60 ORDER = [ 'session_connections', @@ -47,7 +43,7 @@ CHARTS = { ] }, 'all_time_hit_rate': { - 'options': [None, 'All History Hit Rate Ratio', 'percent', 'cache performance', + 'options': [None, 'All History Hit Rate Ratio', 'percentage', 'cache performance', 'varnish.all_time_hit_rate', 'stacked'], 'lines': [ ['cache_hit', 'hit', 'percentage-of-absolute-row'], @@ -55,7 +51,7 @@ CHARTS = { ['cache_hitpass', 'hitpass', 'percentage-of-absolute-row']] }, 'current_poll_hit_rate': { - 'options': [None, 'Current Poll Hit Rate Ratio', 'percent', 'cache performance', + 'options': [None, 'Current Poll Hit Rate Ratio', 'percentage', 'cache performance', 'varnish.current_poll_hit_rate', 'stacked'], 'lines': [ ['cache_hit', 'hit', 'percentage-of-incremental-row'], @@ -127,7 +123,7 @@ CHARTS = { ] }, 'memory_usage': { - 'options': [None, 'Memory Usage', 'MB', 'memory usage', 'varnish.memory_usage', 'stacked'], + 'options': [None, 'Memory Usage', 'MiB', 'memory usage', 'varnish.memory_usage', 'stacked'], 'lines': [ ['memory_free', 'free', 'absolute', 1, 1 << 20], ['memory_allocated', 'allocated', 'absolute', 1, 1 << 20]] @@ -140,6 +136,8 @@ CHARTS = { } } +VARNISHSTAT = 'varnishstat' + class Parser: _backend_new = re.compile(r'VBE.([\d\w_.]+)\(.*?\).(beresp[\w_]+)\s+(\d+)') @@ -176,19 +174,31 @@ class Service(ExecutableService): ExecutableService.__init__(self, configuration=configuration, name=name) self.order = ORDER self.definitions = CHARTS - varnishstat = find_binary('varnishstat') - self.command = [varnishstat, '-1'] if varnishstat else None + self.instance_name = configuration.get('instance_name') self.parser = Parser() + self.command = None + + def create_command(self): + varnishstat = find_binary(VARNISHSTAT) + + if not varnishstat: + self.error("can't locate '{0}' binary or binary is not executable by user netdata".format(VARNISHSTAT)) + return False + + if self.instance_name: + self.command = [varnishstat, '-1', '-n', self.instance_name, '-t', '1'] + else: + self.command = [varnishstat, '-1', '-t', '1'] + return True def check(self): - if not self.command: - self.error("Can't locate 'varnishstat' binary or binary is not executable by user netdata") + if not self.create_command(): return False # STDOUT is not empty reply = self._get_raw_data() if not reply: - self.error("No output from 'varnishstat'. Not enough privileges?") + self.error("No output from 'varnishstat'. Is it running? Not enough privileges?") return False self.parser.init(reply) diff --git a/collectors/python.d.plugin/varnish/varnish.conf b/collectors/python.d.plugin/varnish/varnish.conf index 4b069d514..54bfe4dee 100644 --- a/collectors/python.d.plugin/varnish/varnish.conf +++ b/collectors/python.d.plugin/varnish/varnish.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,11 @@ # # 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, varnish also supports the following: +# +# instance_name: 'name' # the name of the varnishd instance to get logs from. If not specified, the host name is used. +# # ---------------------------------------------------------------------- |