resync/check/recovery rate charts added, add mdstat to Makefiles
lgz committed
Jan 2, 2017 at 01:07 UTC
f748fc73015e9d89ef5222ca070ab7b2a5c3089f
3 files changed
+13
-1
conf.d/Makefile.am
+2
@@ -34,6 +34,7 @@ dist_pythonconfig_DATA = \
34
python.d/hddtemp.conf \
35
python.d/ipfs.conf \
36
python.d/isc_dhcpd.conf \
37
+ python.d/mdstat.conf \
38
python.d/memcached.conf \
39
python.d/mysql.conf \
40
python.d/nginx.conf \
@@ -57,6 +58,7 @@ dist_healthconfig_DATA = \
58
health.d/disks.conf \
59
health.d/entropy.conf \
60
health.d/ipc.conf \
61
+ health.d/mdstat.conf \
62
health.d/memcached.conf \
63
health.d/mysql.conf \
64
health.d/named.conf \
python.d/Makefile.am
+1
@@ -19,6 +19,7 @@ dist_python_SCRIPTS = \
19
hddtemp.chart.py \
20
ipfs.chart.py \
21
isc_dhcpd.chart.py \
22
+ mdstat.chart.py \
23
memcached.chart.py \
24
mysql.chart.py \
25
nginx.chart.py \
python.d/mdstat.chart.py
+10
-1
@@ -19,7 +19,7 @@ class Service(SimpleService):
19
'lines': []}}
20
self.proc_mdstat = '/proc/mdstat'
21
self.regex_disks = compile(r'((?<=\ )[a-zA-Z_0-9]+(?= : active)).*?((?<= \[)[0-9]+)/([0-9]+(?=\] ))')
22
- self.regex_status = compile(r'([a-zA-Z_0-9]+)( : active)[^:]*?([a-z]+) = ([0-9.]+(?=%))')
22
+ self.regex_status = compile(r'([a-zA-Z_0-9]+)( : active)[^:]*?([a-z]+) = ([0-9.]+(?=%)).*?((?<=finish=)[0-9.]+)min speed=([0-9]+)')
23
24
def check(self):
25
raw_data = self._get_raw_data()
@@ -31,6 +31,7 @@ class Service(SimpleService):
31
for md in md_list:
32
self.order.append(md)
33
self.order.append(''.join([md, '_status']))
34
+ self.order.append(''.join([md, '_rate']))
35
self.definitions['agr_health']['lines'].append([''.join([md, '_health']), md, 'absolute'])
36
self.definitions[md] = {'options':
37
[None, 'MD disks stats', 'disks', md, 'md.disks', 'stacked'],
@@ -41,6 +42,10 @@ class Service(SimpleService):
42
'lines': [[''.join([md, '_resync']), 'resync', 'absolute', 1, 100],
43
[''.join([md, '_recovery']), 'recovery', 'absolute', 1, 100],
44
[''.join([md, '_check']), 'check', 'absolute', 1, 100]]}
45
+ self.definitions[''.join([md, '_rate'])] = {'options':
46
+ [None, 'MD operation status', 'rate', md, 'md.rate', 'line'],
47
+ 'lines': [[''.join([md, '_finishin']), 'finish min', 'absolute', 1, 100],
48
+ [''.join([md, '_rate']), 'megabyte/s', 'absolute', -1, 100]]}
49
self.info('Plugin was started successfully. MDs to monitor %s' % (md_list))
50
to_netdata = {}
51
@@ -77,8 +82,12 @@ class Service(SimpleService):
82
to_netdata[''.join([md[0], '_check'])] = 0
83
to_netdata[''.join([md[0], '_resync'])] = 0
84
to_netdata[''.join([md[0], '_recovery'])] = 0
85
+ to_netdata[''.join([md[0], '_finishin'])] = 0
86
+ to_netdata[''.join([md[0], '_rate'])] = 0
87
88
for md in mdstat_status:
89
to_netdata[''.join([md[0], '_' + md[2]])] = round(float(md[3]) * 100)
90
+ to_netdata[''.join([md[0], '_finishin'])] = round(float(md[4]) * 100)
91
+ to_netdata[''.join([md[0], '_rate'])] = round(float(md[5]) / 1000 * 100)
92
93
return to_netdata