smart nvme support

This commit is contained in:
Drakarah 2025-11-23 10:05:55 +00:00
parent ca65324976
commit fcc5061d8c
2 changed files with 23 additions and 1 deletions

View File

@ -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

View File

@ -31,7 +31,7 @@ pydantic
pygal
pymdstat
pymongo
pySMART.smartx
pySMART
pysnmp-lextudio<6.3.1 # Pinned witing implementation of #2874
python-dateutil
pyzmq