7#include "../Data/SystemMemoryInformation.h"
115 virtual void TurnOn()
override;
127 virtual void TurnOff()
override;
168 virtual std::string
ToString()
const override;
Abstract base class for every component (sensor, actuator, etc.) the library manages.
Definition: BaseComponent.h:60
Reads Raspberry Pi system health (temperature, voltage, throttling, memory, storage,...
Definition: SystemHealthComponent.h:20
std::string GetThrottledCodeDescription(const std::string &code) const
Parses a vcgencmd throttled code and describes it, decoding each active/past error bit (under-voltage...
Definition: SystemHealthComponent.cpp:450
std::string GetLocalIP() const
Gets the local IP address from the cached hostname -I output.
Definition: SystemHealthComponent.cpp:630
float GetSystemTemperatureInC() const
Parses the system temperature (in Celsius) from the cached vcgencmd measure_temp output.
Definition: SystemHealthComponent.cpp:528
virtual void CheckForAlerts()
Hands each health reading and its thresholds to the AlertManager (temperature, 5V low/high,...
Definition: SystemHealthComponent.cpp:314
SystemMemoryInformation mySystemMemoryInfo
The most recently read system memory information.
Definition: SystemHealthComponent.h:22
float GetWiFiSignalStrength() const
Parses the WiFi signal strength (in dBm) from the cached iw dev wlan0 link output.
Definition: SystemHealthComponent.cpp:647
virtual std::string ToString() const override
Serializes every cached health reading (temperature, voltage, throttling, memory, storage,...
Definition: SystemHealthComponent.cpp:909
SystemMemoryInformation GetSystemMemoryInformation() const
Reads /proc/meminfo and builds a SystemMemoryInformation from the MemTotal/MemFree/MemAvailable/SwapT...
Definition: SystemHealthComponent.cpp:855
std::map< std::string, std::string > myCommandData
Raw output of each health command, keyed by command.
Definition: SystemHealthComponent.h:23
std::mutex myCommandDataMutex
Guards myCommandData: ProcessRawValues (writer) vs the getters/ToString (readers).
Definition: SystemHealthComponent.h:24
float GetSystemStorageUsedPercent() const
Parses the root file system's used-percentage (from the df output) as a float.
Definition: SystemHealthComponent.cpp:819
std::string GetThrottledCodeAndDescription() const
Gets the throttled-status code (from the cached vcgencmd output) with its human-readable description.
Definition: SystemHealthComponent.cpp:430
std::string GetFirmwareVersion() const
Gets the firmware version from the cached vcgencmd version output.
Definition: SystemHealthComponent.cpp:613
double GetFiveVoltPowerVoltage() const
Parses the external 5V rail voltage from the cached vcgencmd pmic_read_adc output.
Definition: SystemHealthComponent.cpp:570
virtual void TurnOff() override
Turns the component off, reporting the call through the AlertManager.
Definition: SystemHealthComponent.cpp:215
SystemHealthComponent()
Builds the system-health component, seeding its command map with every OS command it will run.
Definition: SystemHealthComponent.cpp:21
bool GetIsRootFileSystemWritable() const
Determines whether the root ("/") file system is mounted writable by scanning /proc/mounts for its op...
Definition: SystemHealthComponent.cpp:695
std::string GetSystemStorageDevicePath() const
Gets the root file system's device path (parsed from the df output).
Definition: SystemHealthComponent.cpp:751
std::string GetCommandOutput(const std::string &command) const
Thread-safe read of one command's cached output: copies the value out under the command-data lock so ...
Definition: SystemHealthComponent.cpp:403
virtual void TurnOn() override
Turns the component on, reporting the call through the AlertManager.
Definition: SystemHealthComponent.cpp:200
std::string GetSystemStorageTotalSize() const
Gets the root file system's total size (parsed from the df output).
Definition: SystemHealthComponent.cpp:768
std::string GetSystemStorageUsed() const
Gets the root file system's used size (parsed from the df output).
Definition: SystemHealthComponent.cpp:785
virtual ~SystemHealthComponent()
Destroys the component, turning it off first.
Definition: SystemHealthComponent.cpp:53
virtual void ProcessRawValues() override
Runs every health command, caches the results, parses the storage figures out of the df output,...
Definition: SystemHealthComponent.cpp:231
std::string GetSystemStorageAvailable() const
Gets the root file system's available size (parsed from the df output).
Definition: SystemHealthComponent.cpp:802
std::string ExecuteCommand(const std::string &command)
Runs an OS command by tokenizing it, spawning the process with posix_spawnp with its stdout redirecte...
Definition: SystemHealthComponent.cpp:73
RumPi is the library's top-level facade.
Definition: AlertManager.h:6