Commit a1be458
authored
feat: issues/1597: Temperature Monitoring - Thanks @MitchellThompkins
# Temperature Monitoring System
## Description
This PR implements a comprehensive temperature monitoring system
integrated into the existing `MetricsResolver`. It provides real-time
access to temperature data from various system sensors via GraphQL
queries and subscriptions.
I tested these changes locally using the provided Apollo Server on
Unraid `7.2.0`.
Addresses [#1597](#1597)
## Key Features
* **Multi-Source Support:**
* **CPU & Motherboard:** Via `lm-sensors` integration.
* **Disks:** Modifies `smartctl` integration
* Modifies `smartctl` to leverage json parsing instead of raw strings.
* **IPMI:** Support for `ipmitool` sensors (see notes below!).
* **GraphQL API:**
* New `temperature` field on the `Metrics` node.
* `systemMetricsTemperature` subscription for real-time updates.
* Exposes `current`, `min`, `max`, and `history` for each sensor.
* **Configuration:**
* Fully configurable via `api.json` (enabled status, polling intervals,
thresholds).
* Support for `default_unit` preference (Celsius/Fahrenheit) with
automatic conversion.
* **History & Aggregation:**
* In-memory history tracking with configurable retention.
* Summary statistics (average temp, hottest/coolest sensor counts).
## Implementation Details
* **Binary Management:** Relies on system-installed tools (`sensors`,
`smartctl`, `ipmitool`) rather than bundling binaries, aligning with the
base OS integration strategy. **There is no attempt here to package
sensor tooling as part of this feature.** This is per a [conversation on
the feature scope with the Unraid
team](#1597 (comment)).
* **Architecture:** Implemented a modular `TemperatureSensorProvider`
interface allowing for easy addition of new sensor types.
* **Robustness:** `DisksService` was updated to parse `smartctl` JSON
output directly, resolving issues with raw string parsing on certain
drive models. There was an issue with some Seagate drives reporting raw
values with extra data in parentheses: `24 (0 14 0 0 0)`. Parsing the
last value in the string returned incorrect data. Parsing with json
prevents this.
* **Testing:** Added unit tests for all additional modules.
## Documentation
* Added developer documentation at `docs/developer/temperature.md`
detailing configuration options and API usage.
## Scope Notes
* **IPMI Integration:** The `IpmiSensorsService` has been implemented to
parse standard `ipmitool` output, but **it has not been tested on live
hardware** as I do not have access to a system with IPMI support. It
relies on standard `ipmitool` output formats (at least the documentation
I saw and what AI told me).
* **GPU:** GPU temperature monitoring is currently out of scope and has
not been implemented. I do not have access to a machine with a GPU and
could not reliably test it.
* **Alerts:** The API calculates and exposes `WARNING` and `CRITICAL`
statuses based on thresholds but does not currently trigger active
system notifications. This type of alert is passive only.
<!-- This is an auto-generated comment: release notes by coderabbit.ai
-->
## Summary by CodeRabbit
## New Features
* Added comprehensive temperature monitoring with real-time metrics for
CPU, disk, and system sensors
* Configurable temperature thresholds and alerts (Warning/Critical
states)
* Support for multiple temperature units (Celsius, Fahrenheit, Kelvin,
Rankine)
* Temperature history tracking and trend analysis capability
* Real-time temperature metric subscriptions
<!-- end of auto-generated comment: release notes by coderabbit.ai -->1 parent db88eb8 commit a1be458
File tree
31 files changed
+4290
-50
lines changed- api
- docs/developer
- src/unraid-api
- cli/generated
- graph/resolvers
- disks
- metrics
- temperature
- sensors
- web/src/composables/gql
31 files changed
+4290
-50
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
84 | 84 | | |
85 | 85 | | |
86 | 86 | | |
| 87 | + | |
87 | 88 | | |
88 | 89 | | |
89 | 90 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
| 1 | + | |
| 2 | + | |
| 3 | + | |
| 4 | + | |
| 5 | + | |
| 6 | + | |
| 7 | + | |
| 8 | + | |
| 9 | + | |
| 10 | + | |
| 11 | + | |
| 12 | + | |
| 13 | + | |
| 14 | + | |
| 15 | + | |
| 16 | + | |
| 17 | + | |
| 18 | + | |
| 19 | + | |
| 20 | + | |
| 21 | + | |
| 22 | + | |
| 23 | + | |
| 24 | + | |
| 25 | + | |
| 26 | + | |
| 27 | + | |
| 28 | + | |
| 29 | + | |
| 30 | + | |
| 31 | + | |
| 32 | + | |
| 33 | + | |
| 34 | + | |
| 35 | + | |
| 36 | + | |
| 37 | + | |
| 38 | + | |
| 39 | + | |
| 40 | + | |
| 41 | + | |
| 42 | + | |
| 43 | + | |
| 44 | + | |
| 45 | + | |
| 46 | + | |
| 47 | + | |
| 48 | + | |
| 49 | + | |
| 50 | + | |
| 51 | + | |
| 52 | + | |
| 53 | + | |
| 54 | + | |
| 55 | + | |
| 56 | + | |
| 57 | + | |
| 58 | + | |
| 59 | + | |
| 60 | + | |
| 61 | + | |
| 62 | + | |
| 63 | + | |
| 64 | + | |
| 65 | + | |
| 66 | + | |
| 67 | + | |
| 68 | + | |
| 69 | + | |
| 70 | + | |
| 71 | + | |
| 72 | + | |
| 73 | + | |
| 74 | + | |
| 75 | + | |
| 76 | + | |
| 77 | + | |
| 78 | + | |
| 79 | + | |
| 80 | + | |
| 81 | + | |
| 82 | + | |
| 83 | + | |
| 84 | + | |
| 85 | + | |
| 86 | + | |
| 87 | + | |
| 88 | + | |
| 89 | + | |
| 90 | + | |
| 91 | + | |
| 92 | + | |
| 93 | + | |
| 94 | + | |
| 95 | + | |
| 96 | + | |
| 97 | + | |
| 98 | + | |
| 99 | + | |
| 100 | + | |
| 101 | + | |
| 102 | + | |
| 103 | + | |
| 104 | + | |
| 105 | + | |
| 106 | + | |
| 107 | + | |
| 108 | + | |
| 109 | + | |
| 110 | + | |
| 111 | + | |
| 112 | + | |
| 113 | + | |
| 114 | + | |
| 115 | + | |
| 116 | + | |
| 117 | + | |
| 118 | + | |
| 119 | + | |
| 120 | + | |
| 121 | + | |
| 122 | + | |
| 123 | + | |
| 124 | + | |
| 125 | + | |
| 126 | + | |
| 127 | + | |
| 128 | + | |
| 129 | + | |
| 130 | + | |
| 131 | + | |
| 132 | + | |
| 133 | + | |
| 134 | + | |
| 135 | + | |
| 136 | + | |
| 137 | + | |
| 138 | + | |
| 139 | + | |
| 140 | + | |
| 141 | + | |
| 142 | + | |
| 143 | + | |
| 144 | + | |
0 commit comments