AsynchronousMetrics: Ignore inaccessible sensors

This commit is contained in:
Raúl Marín 2022-01-14 15:46:03 +01:00
parent 12195b149f
commit ac1665cdcb

View File

@ -109,6 +109,23 @@ void AsynchronousMetrics::openSensors()
else
break;
}
file->rewind();
Int64 temperature = 0;
try
{
readText(temperature, *file);
}
catch (const ErrnoException & e)
{
LOG_WARNING(
&Poco::Logger::get("AsynchronousMetrics"),
"Thermal monitor '{}' exists but could not be read, error {}.",
thermal_device_index,
e.getErrno());
continue;
}
thermal.emplace_back(std::move(file));
}
}
@ -222,6 +239,23 @@ void AsynchronousMetrics::openSensorsChips()
std::replace(sensor_name.begin(), sensor_name.end(), ' ', '_');
}
file->rewind();
Int64 temperature = 0;
try
{
readText(temperature, *file);
}
catch (const ErrnoException & e)
{
LOG_WARNING(
&Poco::Logger::get("AsynchronousMetrics"),
"Hardware monitor '{}', sensor '{}' exists but could not be read, error {}.",
hwmon_name,
sensor_name,
e.getErrno());
continue;
}
hwmon_devices[hwmon_name][sensor_name] = std::move(file);
}
}