python.d: add 'hidden' option to charts
lgz committed
Aug 1, 2018 at 13:44 UTC
08bc82177e133fd4a88e8b422c14cab2c7b298f4
1 file changed
+5
-3
python.d/python_modules/bases/charts.py
+5
-3
@@ -5,7 +5,7 @@
5
6
from bases.collection import safe_print
7
8
-CHART_PARAMS = ['type', 'id', 'name', 'title', 'units', 'family', 'context', 'chart_type']
8
+CHART_PARAMS = ['type', 'id', 'name', 'title', 'units', 'family', 'context', 'chart_type', 'hidden']
9
DIMENSION_PARAMS = ['id', 'name', 'algorithm', 'multiplier', 'divisor', 'hidden']
10
VARIABLE_PARAMS = ['id', 'value']
11
@@ -14,9 +14,9 @@ DIMENSION_ALGORITHMS = ['absolute', 'incremental', 'percentage-of-absolute-row',
14
15
CHART_BEGIN = 'BEGIN {type}.{id} {since_last}\n'
16
CHART_CREATE = "CHART {type}.{id} '{name}' '{title}' '{units}' '{family}' '{context}' " \
17
- "{chart_type} {priority} {update_every} '' 'python.d.plugin' '{module_name}'\n"
17
+ "{chart_type} {priority} {update_every} '{hidden}' 'python.d.plugin' '{module_name}'\n"
18
CHART_OBSOLETE = "CHART {type}.{id} '{name}' '{title}' '{units}' '{family}' '{context}' " \
19
- "{chart_type} {priority} {update_every} 'obsolete'\n"
19
+ "{chart_type} {priority} {update_every} '{hidden} obsolete'\n"
20
21
22
DIMENSION_CREATE = "DIMENSION '{id}' '{name}' {algorithm} {multiplier} {divisor} '{hidden}'\n"
@@ -152,6 +152,8 @@ class Chart:
152
id=self.params['id'])
153
if self.params.get('chart_type') not in CHART_TYPES:
154
self.params['chart_type'] = 'absolute'
155
+ hidden = str(self.params.get('hidden', ''))
156
+ self.params['hidden'] = 'hidden' if hidden == 'hidden' else ''
157
158
self.dimensions = list()
159
self.variables = set()