@cryptotaxi247 / netdata-1 / commits / 9deefe240

remove unnecessary charts

Ilya committed Jan 16, 2017 at 22:44 UTC 9deefe240e59e93f52ef872c60b44a4c82fd0479
1 file changed +29 -133
python.d/varnish.chart.py
+29 -133
@@ -13,18 +13,10 @@ from subprocess import Popen, PIPE
13 priority = 60000
14 retries = 60
15
16 -ORDER = ['hit_rate', 'chit_rate', 'request_rate', 'transfer_rates', 'session', 'backend_traffic', 'memory_usage', 'bad', 'uptime']
17 -EXTRA_ORDER = ['hit_rate','chit_rate', 'request_rate', 'transfer_rates', 'session', 'backend_traffic', 'bad',
18 - 'objects', 'threads', 'memory_usage', 'objects_per_objhead', 'losthdr', 'hcb', 'esi', 'session_herd',
19 - 'shm_writes', 'shm', 'allocations', 'vcl', 'bans', 'bans_lurker', 'expunge', 'lru', 'gzip', 'uptime']
16 +ORDER = ['session', 'hit_rate', 'chit_rate', 'expunge', 'threads', 'backend_health', 'memory_usage', 'bad', 'uptime']
17
21 -CHARTS = {'allocations':
22 - {'lines': [['sm_nreq', None, 'incremental', 1, 1],
23 - ['sma_nreq', None, 'incremental', 1, 1],
24 - ['sms_nreq', None, 'incremental', 1, 1]],
25 - 'options': [None, 'Memory allocation requests', 'units', 'Extra charts', 'varnish.alloc','line']},
26 - 'backend_traffic':
27 - {'lines': [['backend_conn_bt', 'conn', 'incremental', 1, 1],
18 +CHARTS = {'backend_health':
19 + {'lines': [['backend_conn', 'conn', 'incremental', 1, 1],
20 ['backend_unhealthy', 'unhealthy', 'incremental', 1, 1],
21 ['backend_busy', 'busy', 'incremental', 1, 1],
22 ['backend_fail', 'fail', 'incremental', 1, 1],
@@ -33,7 +25,7 @@ CHARTS = {'allocations':
25 ['backend_toolate', 'toolate', 'incremental', 1, 1],
26 ['backend_retry', 'retry', 'incremental', 1, 1],
27 ['backend_req', 'req', 'incremental', 1, 1]],
36 - 'options': [None, 'Backend health', 'units', 'Backend health', 'varnish.backend_traf', 'line']},
28 + 'options': [None, 'Backend health', 'connections', 'Backend health', 'varnish.backend_traf', 'line']},
29 'bad':
30 {'lines': [['sess_drop_b', None, 'incremental', 1, 1],
31 ['backend_unhealthy_b', None, 'incremental', 1, 1],
@@ -42,51 +34,17 @@ CHARTS = {'allocations':
34 ['threads_failed_b', None, 'incremental', 1, 1],
35 ['threads_limited_b', None, 'incremental', 1, 1],
36 ['threads_destroyed_b', None, 'incremental', 1, 1],
45 - ['thread_queue_len', None, 'absolute', 1, 1],
37 + ['thread_queue_len_b', 'queue_len', 'absolute', 1, 1],
38 ['losthdr_b', None, 'incremental', 1, 1],
39 ['esi_errors_b', None, 'incremental', 1, 1],
40 ['esi_warnings_b', None, 'incremental', 1, 1],
41 ['sess_fail_b', None, 'incremental', 1, 1],
42 ['sess_pipe_overflow_b', None, 'incremental', 1, 1]],
51 - 'options': [None, 'Misbehavior', 'units', 'Problems summary', 'varnish.bad', 'line']},
52 - 'bans':
53 - {'lines': [['bans', None, 'absolute', 1, 1],
54 - ['bans_added', 'added', 'incremental', 1, 1],
55 - ['bans_deleted', 'deleted', 'incremental', 1, 1],
56 - ['bans_completed', 'completed', 'absolute', 1, 1],
57 - ['bans_obj', 'obj', 'absolute', 1, 1],
58 - ['bans_req', 'req', 'absolute', 1, 1],
59 - ['bans_tested', 'tested', 'incremental', 1, 1],
60 - ['bans_obj_killed', 'obj_killed', 'incremental', 1, 1],
61 - ['bans_tests_tested', 'tests_tested', 'incremental', 1, 1],
62 - ['bans_dups', 'dups', 'absolute', 1, 1],
63 - ['bans_persisted_bytes', 'pers_bytes', 'absolute', 1, 1],
64 - ['bans_persisted_fragmentation', 'pers_fragmentation', 'absolute', 1, 1]],
65 - 'options': [None, 'Bans', 'units', 'Extra charts', 'varnish.bans', 'line']},
66 - 'bans_lurker':
67 - {'lines': [['bans_lurker_tested', 'tested', 'incremental', 1, 1],
68 - ['bans_lurker_tests_tested', 'tests_tested', 'incremental', 1, 1],
69 - ['bans_lurker_obj_killed', 'obj_killed', 'incremental', 1, 1],
70 - ['bans_lurker_contention', 'contention', 'incremental', 1, 1]],
71 - 'options': [None, 'Ban Lurker', 'units', 'Extra charts', 'varnish.bans_lurker', 'line']},
72 - 'esi':
73 - {'lines': [['esi_parse', None, 'incremental', 1, 1],
74 - ['esi_errors', None, 'incremental', 1, 1],
75 - ['esi_warnings', None, 'incremental', 1, 1]],
76 - 'options': [None, 'ESI', 'units', 'Extra charts', 'varnish.esi', 'line']},
43 + 'options': [None, 'Misbehavior', 'problems', 'Problems summary', 'varnish.bad', 'line']},
44 'expunge':
45 {'lines': [['n_expired', None, 'incremental', 1, 1],
79 - ['n_lru_nuked_e', None, 'incremental', 1, 1]],
80 - 'options': [None, 'Object expunging', 'units', 'Extra charts', 'varnish.expunge', 'line']},
81 - 'gzip':
82 - {'lines': [['n_gzip', None, 'incremental', 1, 1],
83 - ['n_gunzip', None, 'incremental', 1, 1]],
84 - 'options': [None, 'GZIP activity', 'units', 'Extra charts', 'varnish.gzip', 'line']},
85 - 'hcb':
86 - {'lines': [['hcb_nolock', 'nolock', 'incremental', 1, 1],
87 - ['hcb_lock', 'lock', 'incremental', 1, 1],
88 - ['hcb_insert', 'insert', 'incremental', 1, 1]],
89 - 'options': [None, 'Critbit data', 'units', 'Extra charts', 'varnish.hcb', 'line']},
46 + ['n_lru_nuked', None, 'incremental', 1, 1]],
47 + 'options': [None, 'Object expunging', 'objects', 'Cache performance', 'varnish.expunge', 'line']},
48 'hit_rate':
49 {'lines': [['cache_hit_perc', 'hit', 'absolute', 1, 100],
50 ['cache_miss_perc', 'miss', 'absolute', 1, 100],
@@ -97,81 +55,27 @@ CHARTS = {'allocations':
55 ['cache_miss_cperc', 'miss', 'absolute', 1, 100],
56 ['cache_hitpass_cperc', 'hitpass', 'absolute', 1, 100]],
57 'options': [None, 'Current poll hit rate ratio','percent', 'Cache performance', 'varnish.chit_rate', 'stacked']},
100 - 'losthdr':
101 - {'lines': [['losthdr', None, 'incremental', 1, 1]],
102 - 'options': [None, 'HTTP Header overflows', 'units', 'Extra charts', 'varnish.losthdr', 'line']},
103 - 'lru':
104 - {'lines': [['n_lru_nuked', 'nuked', 'incremental', 1, 1],
105 - ['n_lru_moved', 'moved', 'incremental', 1, 1]],
106 - 'options': [None, 'LRU activity', 'units', 'Extra charts', 'varnish.lru', 'line']},
58 'memory_usage':
59 {'lines': [['s0.g_space', 'available', 'absolute', 1, 1048576],
60 ['s0.g_bytes', 'allocated', 'absolute', -1, 1048576]],
61 'options': [None, 'Memory usage', 'megabytes', 'Memory usage', 'varnish.memory_usage', 'stacked']},
111 - 'objects':
112 - {'lines': [['n_object', 'object', 'absolute', 1, 1],
113 - ['n_objectcore', 'objectcore', 'absolute', 1, 1],
114 - ['n_vampireobject', 'vampireobject, ''absolute', 1, 1],
115 - ['n_objecthead', 'objecthead', 'absolute', 1, 1]],
116 - 'options': [None, 'Number of objects', 'units', 'Extra charts', 'varnish.objects', 'line']},
117 - 'objects_per_objhead':
118 - {'lines': [['obj_per_objhead', 'per_objhead', 'absolute', 1, 100]],
119 - 'options': [None, 'Objects per objecthead', 'units', 'Extra charts', 'varnish.objects_per_objhead', 'line']},
120 - 'request_rate':
121 - {'lines': [['sess_conn_rr', None, 'incremental', 1, 1],
122 - ['client_req', None, 'incremental', 1, 1],
123 - ['cache_hit', None, 'incremental', 1, 1],
124 - ['cache_hitpass', None, 'incremental', 1, 1],
125 - ['cache_miss', None, 'incremental', 1, 1],
126 - ['backend_conn', None, 'incremental', 1, 1],
127 - ['backend_unhealthy', None, 'incremental', 1, 1],
128 - ['s_pipe', None, 'incremental', 1, 1],
129 - ['s_pass', None, 'incremental', 1, 1]],
130 - 'options': [None, 'Request rates', 'units', 'Varnish statistics', 'varnish.request_rate', 'line']},
62 'session':
63 {'lines': [['sess_conn', 'conn', 'incremental', 1, 1],
133 - ['sess_drop', 'drop', 'incremental', 1, 1],
134 - ['sess_fail', 'fail', 'incremental', 1, 1],
135 - ['sess_pipe_overflow', 'pipe_overflow', 'incremental', 1, 1],
136 - ['sess_queued', 'queued', 'incremental', 1, 1],
137 - ['sess_dropped', 'dropped', 'incremental', 1, 1],
138 - ['sess_closed', 'closed', 'incremental', 1, 1],
139 - ['sess_pipeline', 'pipeline', 'incremental', 1, 1],
140 - ['sess_readahead' , 'readhead', 'incremental', 1, 1]],
141 -
142 - 'options': [None, 'Sessions', 'units', 'Varnish statistics', 'varnish.session', 'line']},
143 - 'session_herd':
144 - {'lines': [['sess_herd', None, 'incremental', 1, 1]],
145 - 'options': [None, 'Session herd', 'units', 'Extra charts', 'varnish.session_herd', 'line']},
146 - 'shm':
147 - {'lines': [['shm_flushes', 'flushes', 'incremental', 1, 1],
148 - ['shm_cont', 'cont', 'incremental', 1, 1],
149 - ['shm_cycles', 'cycles', 'incremental', 1, 1]],
150 - 'options': [None, 'SHM writes and records', 'units', 'Extra charts', 'varnish.shm', 'line']},
151 - 'shm_writes':
152 - {'lines': [['shm_records', 'records', 'incremental', 1, 1],
153 - ['shm_writes', 'writes', 'incremental', 1, 1]],
154 - 'options': [None, 'SHM writes and records', 'units', 'Extra charts', 'varnish.shm_writes', 'line']},
64 + ['client_req', 'drop', 'incremental', 1, 1],
65 + ['sess_dropped', 'fail', 'incremental', 1, 1]],
66 + 'options': [None, 'Sessions', 'units', 'Client metrics', 'varnish.session', 'line']},
67 'threads':
68 {'lines': [['threads', None, 'absolute', 1, 1],
69 ['threads_created', 'created', 'incremental', 1, 1],
70 ['threads_failed', 'failed', 'incremental', 1, 1],
71 ['threads_limited', 'limited', 'incremental', 1, 1],
160 - ['threads_destroyed', 'destroyed', 'incremental', 1, 1]],
161 - 'options': [None, 'Thread status', 'units', 'Extra charts', 'varnish.threads', 'line']},
162 - 'transfer_rates':
163 - {'lines': [['s_resp_hdrbytes', 'header', 'incremental', 8, 1000],
164 - ['s_resp_bodybytes', 'body', 'incremental', -8, 1000]],
165 - 'options': [None, 'Transfer rates', 'kilobit/s', 'Varnish statistics', 'varnish.transfer_rates', 'area']},
72 + ['thread_queue_len', 'queue_len', 'incremental', 1, 1],
73 + ['sess_queued', 'sess_queued', 'incremental', 1, 1]],
74 + 'options': [None, 'Thread status', 'threads', 'Thread-related metrics', 'varnish.threads', 'line']},
75 'uptime':
76 {'lines': [['uptime', None, 'absolute', 1, 1]],
168 - 'options': [None, 'Varnish uptime', 'seconds', 'Varnish statistics', 'varnish.uptime', 'line']},
169 - 'vcl':
170 - {'lines': [['n_backend', None, 'absolute', 1, 1],
171 - ['n_vcl', None, 'incremental', 1, 1],
172 - ['n_vcl_avail', None, 'incremental', 1, 1],
173 - ['n_vcl_discard', None, 'incremental', 1, 1]],
174 - 'options': [None, 'VCL', 'units', 'Extra charts', 'varnish.vcl', 'line']}}
77 + 'options': [None, 'Varnish uptime', 'seconds', 'Uptime', 'varnish.uptime', 'line']}
78 +}
79
80 DIRECTORIES = ['/bin/', '/usr/bin/', '/sbin/', '/usr/sbin/']
81
@@ -191,8 +95,7 @@ class Service(SimpleService):
95 # VBE.default2(127.0.0.2,,81).bereq_bodybytes (old)
96 # Regex result: [('super_backend', 'beresp_hdrbytes', '0'), ('super_backend', 'beresp_bodybytes', '0')]
97 self.rgx_bck = (compile(r'VBE.([\d\w_.]+)\(.*?\).(beresp[\w_]+)\s+(\d+)'),
194 - compile(r'VBE.boot.([\w\d_]+).(beresp[\w_]+)\s+(\d+)'))
195 - self.extra_charts = self.configuration.get('extra_charts', [])
98 + compile(r'VBE\.[\d\w-]+\.([\w\d_]+).(beresp[\w_]+)\s+(\d+)'))
99 self.cache_prev = list()
100
101 def check(self):
@@ -225,7 +128,6 @@ class Service(SimpleService):
128 # We are about to start!
129 self.create_charts()
130
228 - self.info('Active charts: %s' % self.order)
131 self.info('Plugin was started successfully')
132 return True
133
@@ -282,15 +184,9 @@ class Service(SimpleService):
184
185 self.cache_prev = [to_netdata.get('cache_hit', 0), to_netdata.get('cache_miss', 0), to_netdata.get('cache_hitpass', 0)]
186
285 - # 3.2 Copy random stuff to new keys (do we need this?)
286 - to_netdata['obj_per_objhead'] = find_percent(to_netdata.get('n_object', 0),
287 - to_netdata.get('n_objecthead', 0), 100)
288 - to_netdata['backend_conn_bt'] = to_netdata.get('backend_conn', 0)
289 - to_netdata['sess_conn_rr'] = to_netdata.get('sess_conn', 0)
290 - to_netdata['n_lru_nuked_e'] = to_netdata.get('n_lru_nuked', 0)
291 -
187 + # 3.3 Problems summary chart
188 for elem in ['backend_busy', 'backend_unhealthy', 'esi_errors', 'esi_warnings', 'losthdr', 'sess_drop',
293 - 'sess_fail', 'sess_pipe_overflow', 'threads_destroyed', 'threads_failed', 'threads_limited']:
189 + '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)
191
192 # Ready steady go!
@@ -298,17 +194,17 @@ class Service(SimpleService):
194
195 def create_charts(self):
196 # If 'all_charts' is true...ALL charts are displayed. If no only default + 'extra_charts'
301 - if self.configuration.get('all_charts'):
302 - self.order = EXTRA_ORDER
303 - else:
304 - try:
305 - extra_charts = list(filter(lambda chart: chart in EXTRA_ORDER, self.extra_charts.split()))
306 - except (AttributeError, NameError, ValueError):
307 - self.error('Extra charts disabled.')
308 - extra_charts = []
197 + #if self.configuration.get('all_charts'):
198 + # self.order = EXTRA_ORDER
199 + #else:
200 + # try:
201 + # extra_charts = list(filter(lambda chart: chart in EXTRA_ORDER, self.extra_charts.split()))
202 + # except (AttributeError, NameError, ValueError):
203 + # self.error('Extra charts disabled.')
204 + # extra_charts = []
205
310 - self.order = ORDER[:]
311 - self.order.extend(extra_charts)
206 + self.order = ORDER[:]
207 + #self.order.extend(extra_charts)
208
209 # Create static charts
210 self.definitions = {chart: values for chart, values in CHARTS.items() if chart in self.order}