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/varnish.chart.py | |
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 '')
-rw-r--r-- | collectors/python.d.plugin/varnish/varnish.chart.py | 34 |
1 files changed, 22 insertions, 12 deletions
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) |