puppet module: minor refactoring & fixes
Andrey Galkin committed
May 3, 2018 at 10:52 UTC
3b6964db001153cb29880ab99e8be16b43589123
1 file changed
+19
-15
python.d/puppet.chart.py
+19
-15
@@ -19,6 +19,8 @@ priority = 60000
19
# very long clojure-based service startup time
20
retries = 180
21
22
+MB = 1048576
23
+CPU_SCALE = 1000
24
ORDER = [
25
'jvm_heap',
26
'jvm_nonheap',
@@ -29,26 +31,28 @@ CHARTS = {
31
'jvm_heap': {
32
'options': [None, "JVM Heap", "MB", "resources", "puppet.jvm", "area"],
33
'lines': [
32
- ["jvm_heap_max", 'max', "absolute", 1, 1048576, 'hidden'],
33
- ["jvm_heap_committed", 'committed', "absolute", 1, 1048576],
34
- ["jvm_heap_used", 'used', "absolute", 1, 1048576],
35
- ["jvm_heap_init", 'initial', "absolute", 1, 1048576, 'hidden'],
36
- ]
34
+ ["jvm_heap_committed", 'committed', "absolute", 1, MB],
35
+ ["jvm_heap_used", 'used', "absolute", 1, MB],
36
+ ],
37
+ 'variables': [
38
+ ['jvm_heap_max', 'jvm_heap_init'],
39
+ ],
40
},
41
'jvm_nonheap': {
42
'options': [None, "JVM Non-Heap", "MB", "resources", "puppet.jvm", "area"],
43
'lines': [
41
- ["jvm_nonheap_max", 'max', "absolute", 1, 1048576, 'hidden'],
42
- ["jvm_nonheap_committed", 'committed', "absolute", 1, 1048576],
43
- ["jvm_nonheap_used", 'used', "absolute", 1, 1048576],
44
- ["jvm_nonheap_init", 'initial', "absolute", 1, 1048576, 'hidden'],
45
- ]
44
+ ["jvm_nonheap_committed", 'committed', "absolute", 1, MB],
45
+ ["jvm_nonheap_used", 'used', "absolute", 1, MB],
46
+ ],
47
+ 'variables': [
48
+ ['jvm_heap_max', 'jvm_heap_init'],
49
+ ],
50
},
51
'cpu': {
48
- 'options': [None, "CPU usage", "descriptors", "resources", "puppet.cpu", "stacked"],
52
+ 'options': [None, "CPU usage", "percentage", "resources", "puppet.cpu", "stacked"],
53
'lines': [
50
- ["cpu_time", 'execution', "absolute", 1, 1000],
51
- ["gc_time", 'GC', "absolute", 1, 1000],
54
+ ["cpu_time", 'execution', "absolute", 1, CPU_SCALE],
55
+ ["gc_time", 'GC', "absolute", 1, CPU_SCALE],
56
]
57
},
58
'fd_open': {
@@ -105,8 +109,8 @@ class Service(UrlService):
109
data['fd_max'] = fd_open['max']
110
data['fd_used'] = fd_open['used']
111
108
- data['cpu_time'] = int(jvm_metrics['cpu-usage'] * 1000)
109
- data['gc_time'] = int(jvm_metrics['gc-cpu-usage'] * 1000)
112
+ data['cpu_time'] = int(jvm_metrics['cpu-usage'] * CPU_SCALE)
113
+ data['gc_time'] = int(jvm_metrics['gc-cpu-usage'] * CPU_SCALE)
114
except KeyError:
115
pass
116