Skip to content

Commit

Permalink
iostats for nvme drives
Browse files Browse the repository at this point in the history
  • Loading branch information
vfuse committed Feb 1, 2018
1 parent feec103 commit 265ec99
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 6 deletions.
2 changes: 1 addition & 1 deletion nixstatsagent/nixstatsagent.py
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@
import urllib2


__version__ = '1.1.35'
__version__ = '1.1.36'

__FILEABSDIRNAME__ = os.path.dirname(os.path.abspath(__file__))

Expand Down
14 changes: 9 additions & 5 deletions nixstatsagent/plugins/iostat.py
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,9 @@ def diskstats_parse(dev=None):
file_path = '/proc/diskstats'
result = {}

if not os.path.isfile("/proc/diskstats"):
return False

# ref: http://lxr.osuosl.org/source/Documentation/iostats.txt
columns_disk = ['m', 'mm', 'dev', 'reads', 'rd_mrg', 'rd_sectors',
'ms_reading', 'writes', 'wr_mrg', 'wr_sectors',
Expand All @@ -35,7 +38,9 @@ def diskstats_parse(dev=None):

data = dict(zip(columns, split))

if data['dev'][-1:].isdigit() is True:
if data['dev'][:3] == 'nvm' and data['dev'][-2:-1] == 'n':
pass
elif data['dev'][-1:].isdigit() is True:
continue

if "loop" in data['dev'] or "ram" in data['dev']:
Expand All @@ -55,9 +60,8 @@ class Plugin(plugins.BasePlugin):
__name__ = 'iostat'

def run(self, *unused):
if(os.path.isfile("/proc/diskstats")):
return diskstats_parse()
else:
results = diskstats_parse()
if not results or results is False:
results = {}
try:
diskdata = psutil.disk_io_counters(perdisk=True)
Expand All @@ -68,7 +72,7 @@ def run(self, *unused):
results[device] = device_stats
except Exception as e:
results = e.message
return results
return results


if __name__ == '__main__':
Expand Down

0 comments on commit 265ec99

Please sign in to comment.