python-diamond / Diamond

Diamond is a python daemon that collects system metrics and publishes them to Graphite (and others). It is capable of collecting cpu, memory, network, i/o, load and disk metrics. Additionally, it features an API for implementing custom collectors for gathering metrics from almost any source.
http://diamond.readthedocs.org/
MIT License
1.74k stars 600 forks source link

relax regular expression matching expection on mdstat._parse_array_me… #740

Closed labeneator closed 2 years ago

labeneator commented 4 years ago

fixes issue #739.


In [1]: from mdstat import MdStatCollector

In [2]: import re

In [3]: md = MdStatCollector()

In [4]: md._parse_mdstat()
sda5[0]
sdc5[1]
raid1
sda2[0]
sdc2[1]
Out[4]:
{'md1': {'member_count': {'active': 2, 'faulty': 0, 'spare': 0},
  'status': {'actual_members': 2,
   'blocks': 3904448,
   'superblock_version': 1.2,
   'total_members': 2}},
 'md2': {'bitmap': {'allocated_pages': '2',
   'chunk_size': '65536',
   'page_size': '8',
   'total_pages': '2'},
  'member_count': {'active': 2, 'faulty': 0, 'spare': 0},
  'status': {'actual_members': 2,
   'blocks': 239124288,
   'superblock_version': 1.2,
   'total_members': 2}}}

In [5]:

In [5]: !cat /proc/mdstat
Personalities : [raid1] [linear] [multipath] [raid0] [raid6] [raid5] [raid4] [raid10]
md2 : active raid1 sda5[0] sdc5[1]
      239124288 blocks super 1.2 [2/2] [UU]
      bitmap: 2/2 pages [8KB], 65536KB chunk

md1 : active (auto-read-only) raid1 sda2[0] sdc2[1]
      3904448 blocks super 1.2 [2/2] [UU]

md0 : active raid1 sda1[0] sdc1[1]
      975296 blocks super 1.2 [2/2] [UU]

unused devices: <none>
coveralls commented 4 years ago

Coverage Status

Coverage remained the same at 24.394% when pulling 861be08ecdf4c2314bb64cd13893d3a647aa0832 on labeneator:master into 0f3eb04327d6d3ed5e53a9967d6c9d2c09714a47 on python-diamond:master.