mirror of https://github.com/nicolargo/glances.git
smart nvme support
This commit is contained in:
parent
ca65324976
commit
fcc5061d8c
|
|
@ -41,6 +41,7 @@ from glances.plugins.plugin.model import GlancesPluginModel
|
|||
# Import plugin specific dependency
|
||||
try:
|
||||
from pySMART import DeviceList
|
||||
from pySMART.interface.nvme import NvmeAttributes
|
||||
except ImportError as e:
|
||||
import_error_tag = True
|
||||
logger.warning(f"Missing Python Lib ({e}), HDD Smart plugin is disabled")
|
||||
|
|
@ -62,6 +63,18 @@ def convert_attribute_to_dict(attr):
|
|||
'when_failed': attr.when_failed,
|
||||
}
|
||||
|
||||
def convert_nvme_attribute_to_dict(key,value):
|
||||
return {
|
||||
'name': key,
|
||||
'value': value,
|
||||
'flags': None,
|
||||
'raw': value,
|
||||
'worst': None,
|
||||
'threshold': None,
|
||||
'type': None,
|
||||
'updated': None,
|
||||
'when_failed': None
|
||||
}
|
||||
|
||||
def get_smart_data():
|
||||
"""
|
||||
|
|
@ -115,6 +128,15 @@ def get_smart_data():
|
|||
continue
|
||||
|
||||
stats[-1][num] = attrib_dict
|
||||
|
||||
if isinstance(dev.if_attributes, NvmeAttributes):
|
||||
idx = 0
|
||||
for attr in dev.if_attributes.__dict__.keys():
|
||||
attrib_dict = convert_nvme_attribute_to_dict(attr, dev.if_attributes.__dict__[attr])
|
||||
idx +=1
|
||||
|
||||
stats[-1][idx] = attrib_dict
|
||||
|
||||
return stats
|
||||
|
||||
|
||||
|
|
|
|||
|
|
@ -31,7 +31,7 @@ pydantic
|
|||
pygal
|
||||
pymdstat
|
||||
pymongo
|
||||
pySMART.smartx
|
||||
pySMART
|
||||
pysnmp-lextudio<6.3.1 # Pinned witing implementation of #2874
|
||||
python-dateutil
|
||||
pyzmq
|
||||
|
|
|
|||
Loading…
Reference in New Issue