|
@@ -3,6 +3,7 @@ using System.Collections.Generic;
|
|
using System.Linq;
|
|
using System.Linq;
|
|
using NLog;
|
|
using NLog;
|
|
using LibreHardwareMonitor.Hardware;
|
|
using LibreHardwareMonitor.Hardware;
|
|
|
|
+using LibreHardwareMonitor.Hardware.Storage;
|
|
|
|
|
|
namespace OhmGraphite
|
|
namespace OhmGraphite
|
|
{
|
|
{
|
|
@@ -16,6 +17,9 @@ namespace OhmGraphite
|
|
private readonly ConcurrentDictionary<Identifier, object> _ids =
|
|
private readonly ConcurrentDictionary<Identifier, object> _ids =
|
|
new ConcurrentDictionary<Identifier, object>();
|
|
new ConcurrentDictionary<Identifier, object>();
|
|
|
|
|
|
|
|
+ private readonly ConcurrentDictionary<Identifier, OhmNvme> _nvmes =
|
|
|
|
+ new ConcurrentDictionary<Identifier, OhmNvme>();
|
|
|
|
+
|
|
public SensorCollector(Computer computer, MetricConfig config)
|
|
public SensorCollector(Computer computer, MetricConfig config)
|
|
{
|
|
{
|
|
_computer = computer;
|
|
_computer = computer;
|
|
@@ -64,6 +68,16 @@ namespace OhmGraphite
|
|
SensorAdded(sensor);
|
|
SensorAdded(sensor);
|
|
}
|
|
}
|
|
|
|
|
|
|
|
+ if (hardware is NVMeGeneric nvme)
|
|
|
|
+ {
|
|
|
|
+ var ohmNvme = new OhmNvme(nvme);
|
|
|
|
+ _nvmes.TryAdd(hardware.Identifier, ohmNvme);
|
|
|
|
+ SensorAdded(ohmNvme.MediaErrors);
|
|
|
|
+ SensorAdded(ohmNvme.PowerCycles);
|
|
|
|
+ SensorAdded(ohmNvme.ErrorInfoLogEntryCount);
|
|
|
|
+ SensorAdded(ohmNvme.UnsafeShutdowns);
|
|
|
|
+ }
|
|
|
|
+
|
|
foreach (var sub in hardware.SubHardware)
|
|
foreach (var sub in hardware.SubHardware)
|
|
{
|
|
{
|
|
HardwareAdded(sub);
|
|
HardwareAdded(sub);
|
|
@@ -81,6 +95,14 @@ namespace OhmGraphite
|
|
SensorRemoved(sensor);
|
|
SensorRemoved(sensor);
|
|
}
|
|
}
|
|
|
|
|
|
|
|
+ if (_nvmes.TryRemove(hardware.Identifier, out OhmNvme ohmNvme))
|
|
|
|
+ {
|
|
|
|
+ SensorRemoved(ohmNvme.MediaErrors);
|
|
|
|
+ SensorRemoved(ohmNvme.PowerCycles);
|
|
|
|
+ SensorRemoved(ohmNvme.ErrorInfoLogEntryCount);
|
|
|
|
+ SensorRemoved(ohmNvme.UnsafeShutdowns);
|
|
|
|
+ }
|
|
|
|
+
|
|
foreach (var sub in hardware.SubHardware)
|
|
foreach (var sub in hardware.SubHardware)
|
|
{
|
|
{
|
|
HardwareRemoved(sub);
|
|
HardwareRemoved(sub);
|
|
@@ -103,6 +125,11 @@ namespace OhmGraphite
|
|
public IEnumerable<ReportedValue> ReadAllSensors()
|
|
public IEnumerable<ReportedValue> ReadAllSensors()
|
|
{
|
|
{
|
|
_computer.Accept(_updateVisitor);
|
|
_computer.Accept(_updateVisitor);
|
|
|
|
+ foreach (var nvme in _nvmes.Values)
|
|
|
|
+ {
|
|
|
|
+ nvme.Update();
|
|
|
|
+ }
|
|
|
|
+
|
|
return _ids.Values.OfType<ISensor>().SelectMany(ReportedValues);
|
|
return _ids.Values.OfType<ISensor>().SelectMany(ReportedValues);
|
|
}
|
|
}
|
|
|
|
|