@cryptotaxi247 / netdata-1 / commits / b82488b48

varnish plugin: version3 support added

Ilya committed Jan 20, 2017 at 13:17 UTC b82488b48df1dadb946dc66397f377ba5000a122
1 file changed +11 -7
python.d/varnish.chart.py
+11 -7
@@ -60,9 +60,11 @@ CHARTS = {'backend_health':
60 ['s0.g_bytes', 'allocated', 'absolute', -1, 1048576]],
61 'options': [None, 'Memory usage', 'megabytes', 'Memory usage', 'varnish.memory_usage', 'stacked']},
62 'session':
63 - {'lines': [['sess_conn', 'conn', 'incremental', 1, 1],
64 - ['client_req', 'requests', 'incremental', 1, 1],
65 - ['sess_dropped', 'dropped', 'incremental', 1, 1]],
63 + {'lines': [['sess_conn', 'sess_conn', 'incremental', 1, 1],
64 + ['client_req', 'client_requests', 'incremental', 1, 1],
65 + ['client_conn', 'client_conn', 'incremental', 1, 1],
66 + ['client_drop', 'client_drop', 'incremental', 1, 1],
67 + ['sess_dropped', 'sess_dropped', 'incremental', 1, 1]],
68 'options': [None, 'Sessions', 'units', 'Client metrics', 'varnish.session', 'line']},
69 'threads':
70 {'lines': [['threads', None, 'absolute', 1, 1],
@@ -88,7 +90,7 @@ class Service(SimpleService):
90 if is_executable(''.join([directory, 'varnishstat']), X_OK)][0]
91 except IndexError:
92 self.varnish = False
91 - self.rgx_all = compile(r'([A-Z]+\.)([\d\w_.]+)\s+(\d+)')
93 + self.rgx_all = compile(r'([A-Z]+\.)?([\d\w_.]+)\s+(\d+)')
94 # Could be
95 # VBE.boot.super_backend.pipe_hdrbyte (new)
96 # or
@@ -114,7 +116,7 @@ class Service(SimpleService):
116 # 2. Output is parsable (list is not empty after regex findall)
117 is_parsable = self.rgx_all.findall(reply)
118 if not is_parsable:
117 - self.error('Cant parse output (only varnish version 4+ supported)')
119 + self.error('Cant parse output...')
120 return False
121
122 # We need to find the right regex for backend parse
@@ -187,7 +189,8 @@ class Service(SimpleService):
189 # 3.3 Problems summary chart
190 for elem in ['backend_busy', 'backend_unhealthy', 'esi_errors', 'esi_warnings', 'losthdr', 'sess_drop',
191 'sess_fail', 'sess_pipe_overflow', 'threads_destroyed', 'threads_failed', 'threads_limited', 'thread_queue_len']:
190 - to_netdata[''.join([elem, '_b'])] = to_netdata.get(elem, 0)
192 + if to_netdata.get(elem) is not None:
193 + to_netdata[''.join([elem, '_b'])] = to_netdata.get(elem)
194
195 # Ready steady go!
196 return to_netdata
@@ -207,7 +210,8 @@ class Service(SimpleService):
210 #self.order.extend(extra_charts)
211
212 # Create static charts
210 - self.definitions = {chart: values for chart, values in CHARTS.items() if chart in self.order}
213 + #self.definitions = {chart: values for chart, values in CHARTS.items() if chart in self.order}
214 + self.definitions = CHARTS
215
216 # Create dynamic backend charts
217 if self.backend_list: