27 const char* temp_path =
"/sys/class/thermal/thermal_zone0/temp");
33 inline std::string
prefix() const noexcept final {
return "cpu_temperature"; }
39 void write(Dictionary& observation)
final;
51 void check_temperature_warning(
const double temperature) noexcept;
55 bool is_disabled_ =
false;
Source for CPU temperature readings.
std::string prefix() const noexcept final
Prefix of output in the observation dictionary.
CpuTemperature(const char *temp_path="/sys/class/thermal/thermal_zone0/temp")
Open file to query temperature from the kernel.
void write(Dictionary &observation) final
Write output to a dictionary.
bool is_disabled() const
Check if temperature observations are disabled.
~CpuTemperature() override
Close file.
constexpr unsigned kCpuTemperatureBufferSize
Characters required to read the temperature in [mC] from the kernel.