-
Notifications
You must be signed in to change notification settings - Fork 17
issues/1597: Temperature Monitoring #1876
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Open
MitchellThompkins
wants to merge
86
commits into
unraid:main
Choose a base branch
from
MitchellThompkins:mthompkins/issues/1597-temperature-monitoring
base: main
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
Changes from all commits
Commits
Show all changes
86 commits
Select commit
Hold shift + click to select a range
46046eb
Really just copy/paste from feature request
MitchellThompkins d8b5389
modified these files a little bit to check for install
MitchellThompkins 89356bc
copy/paste some more functions and do some minor clean-up
MitchellThompkins a878c47
add temperature module
MitchellThompkins b288994
okay, I'm new to typescript and don't know what I'm doing yet but get…
MitchellThompkins 3ac98bc
starting to actually build this out
MitchellThompkins b867834
fix typescript typing issues
MitchellThompkins 45b3816
I don't expect the tests to pass but pnpm exec tsc --noEmit is happy …
MitchellThompkins 702ae9c
apparently this needs to be injectable for Nest?
MitchellThompkins 5a5d3d9
deconflict graphql name for now
MitchellThompkins 694cf68
Deconflict graphql names
MitchellThompkins 644b56c
hardcode this file for now
MitchellThompkins 0063a8a
try a new parsing method
MitchellThompkins a299d66
hey, this actually returns data to the graphql query
MitchellThompkins 88719fd
Parsing json is a lot more reliable than stupid regex
MitchellThompkins 0a2d6be
Add some simple cacheing
MitchellThompkins 8fc82c3
update this to use lm-sensors class
MitchellThompkins fe82be0
Need to pass LMSensorsObject For NodeJS
MitchellThompkins 35b5e24
Need to pass LMSensorsObject For NodeJS
MitchellThompkins db915a1
oops I forgot to check this in
MitchellThompkins 9b350ca
idk what I was doing before but this actually passes in the LmService…
MitchellThompkins 33150ec
Make this a bit more extensible
MitchellThompkins 7c9717f
rename this file b/c I don't like underscores
MitchellThompkins f576460
Add a disk sensor service as a wrapper
MitchellThompkins 8736b0d
claude tells me this needs to be an export as well
MitchellThompkins 69493bd
First pass at adding history
MitchellThompkins ab7da0c
Forgot to add this to the service
MitchellThompkins 61a054d
try to add basic config service
MitchellThompkins efd0e1f
add this config service control
MitchellThompkins dcefb98
adding unit tests
MitchellThompkins 2901d2d
update tests
MitchellThompkins 19441e4
update unit tests
MitchellThompkins 6345e75
fixing unit tests
MitchellThompkins 71ab7e2
more unit test fixes
MitchellThompkins 7c4f662
okay these tests actually pass now!
MitchellThompkins 281dcb1
Add config to check if temperature feature is enabled
MitchellThompkins 9071522
Remove duplicate import lol
MitchellThompkins 686cc81
trying to get api to accept config file
MitchellThompkins 097f768
add some debug info
MitchellThompkins 02f6718
hey the config actually loads now!
MitchellThompkins 731e8f8
fix tests after I figured out how to read config file
MitchellThompkins f1a1e24
update api-config
MitchellThompkins d9b80a4
update with new providers
MitchellThompkins 8f9dd51
comments
MitchellThompkins 63722cd
fix unit tests for lm_sensors
MitchellThompkins 8861a82
implement remaining todos
MitchellThompkins fa1354b
forgot to check this in
MitchellThompkins 9196778
parse json instead of strings, because some drives return an unexpect…
MitchellThompkins f21e1aa
fixed this diskservice unit test
MitchellThompkins a21c31c
add ipmi config
MitchellThompkins 2f7a26a
slight update
MitchellThompkins 7b49f8b
remove AI lies
MitchellThompkins 01644ce
handle more temperature types
MitchellThompkins 6fbad30
add more silly temperatures
MitchellThompkins d855946
I forgot to check in this file!
MitchellThompkins 5c94746
add default api.json for development
MitchellThompkins 5e18bfb
allow thresholds to use target units
MitchellThompkins 52e5b32
need to include the original dev api content
MitchellThompkins fd81810
remove incorrect comment
MitchellThompkins f9cad0d
Handle user defined temperature thresholds and typo clean-up
MitchellThompkins 9e2abc1
update docs
MitchellThompkins 5856142
revert the default api sandbox
MitchellThompkins f735e9b
revert this change
MitchellThompkins bc6c1c5
add lm_sensor timeout
MitchellThompkins 60776ac
make threshold configuration more robust
MitchellThompkins 57529ea
do some slightly safer handling of Record objects
MitchellThompkins 1b74793
filter out NaN, Inf, and -Inf. Add tests for it.
MitchellThompkins 3a65f63
remove unused variable
MitchellThompkins 00820c0
remove unused variable
MitchellThompkins cb6a1a9
documentation update
MitchellThompkins 41b6432
Add checks for 0 deg C and update unit tests to reflect that. Also ad…
MitchellThompkins 341754a
do not use any
MitchellThompkins 4c3de3d
do not use any in lm_sensors.service.spec.ts
MitchellThompkins 7cae963
I let AI try to correct other useages of any, but need to test it first
MitchellThompkins 7ac9641
The great any purge from tests
MitchellThompkins 1ad71c7
Remove usage of any in temperature.service.spec.ts
MitchellThompkins af73fa5
rip out more usage of any
MitchellThompkins 9cfd14d
do not use non-null operator in this way
MitchellThompkins 805020d
get rid of more usages of any
MitchellThompkins 0fe051d
copy timeout pattern for ipmi (again, I have not been able to actuall…
MitchellThompkins 27a04af
I let gemini churn on the type errors in the unit tests and it did up…
MitchellThompkins 749d9c8
add unit tests for impi sensors
MitchellThompkins ab13466
Handle null-able payload and update unit tests
MitchellThompkins 6feddff
removed misleading comment
MitchellThompkins ce9d0cb
remove extra comments
MitchellThompkins f8ecc23
fix some minor typing issues. I think non-null is fine here
MitchellThompkins File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,141 @@ | ||
| # Temperature Monitoring | ||
|
|
||
| The Temperature Monitoring feature allows the Unraid API to collect and expose temperature metrics from various sensors (CPU, Disks, Motherboard, etc.). | ||
|
|
||
| ## Configuration | ||
|
|
||
| You can configure the temperature monitoring behavior in your `api.json`. | ||
| Nominally the `api.json` file is found at | ||
| `/boot/config/plugins/dynamix.my.servers/configs/`. | ||
|
|
||
| ### `api.temperature` Object | ||
|
|
||
| | Key | Type | Default | Description | | ||
| | :--- | :--- | :--- | :--- | | ||
| | `enabled` | `boolean` | `true` | Globally enable or disable temperature monitoring. | | ||
| | `default_unit` | `string` | `"celsius"` | The unit to return values in. Options: `"celsius"`, `"fahrenheit"`, `"kelvin"`, `"rankine"`. | | ||
| | `polling_interval` | `number` | `5000` | Polling interval in milliseconds for the subscription. | | ||
| | `history.max_readings` | `number` | `1000` | (Internal) Number of historical data points to keep in memory per sensor. | | ||
MitchellThompkins marked this conversation as resolved.
Show resolved
Hide resolved
|
||
| | `history.retention_ms` | `number` | `86400000` | (Internal) Retention period for historical data in milliseconds. | | ||
|
|
||
| ### `api.temperature.sensors` Object | ||
|
|
||
| Enable or disable specific sensor providers. | ||
|
|
||
| | Key | Type | Default | Description | | ||
| | :--- | :--- | :--- | :--- | | ||
| | `lm_sensors.enabled` | `boolean` | `true` | Enable `lm-sensors` provider (requires `sensors` binary). | | ||
| | `lm_sensors.config_path` | `string` | `null` | Optional path to a specific sensors config file (passed as `-c` to `sensors`). | | ||
| | `smartctl.enabled` | `boolean` | `true` | Enable disk temperature monitoring via `smartctl` (via DiskService). | | ||
| | `ipmi.enabled` | `boolean` | `true` | Enable IPMI sensor provider (requires `ipmitool`). | | ||
|
|
||
| ### `api.temperature.thresholds` Object | ||
|
|
||
| Customize warning and critical thresholds. | ||
|
|
||
| | Key | Type | Default | Description | | ||
| | :--- | :--- | :--- | :--- | | ||
| | `cpu_warning` | `number` | `70` | Warning threshold for CPU. | | ||
| | `cpu_critical` | `number` | `85` | Critical threshold for CPU. | | ||
| | `disk_warning` | `number` | `50` | Warning threshold for Disks. | | ||
| | `disk_critical` | `number` | `60` | Critical threshold for Disks. | | ||
|
|
||
| ### Sample Configuration | ||
|
|
||
| Example of an `api.json` configuration file: | ||
|
|
||
| ```json | ||
| { | ||
| "version": "4.28.2+9196778e", | ||
| "extraOrigins": [], | ||
| "sandbox": true, | ||
| "ssoSubIds": [], | ||
| "plugins": [ | ||
| "unraid-api-plugin-connect" | ||
| ], | ||
| "temperature": { | ||
| "enabled": true, | ||
| "polling_interval": 10000, | ||
| "default_unit": "celsius", | ||
| "history": { | ||
| "max_readings": 144, | ||
| "retention_ms": 86400000 | ||
| }, | ||
| "thresholds": { | ||
| "cpu_warning": 75, | ||
| "cpu_critical": 90, | ||
| "disk_warning": 50, | ||
| "disk_critical": 60 | ||
| }, | ||
| "sensors": { | ||
| "lm_sensors": { | ||
| "enabled": true, | ||
| "config_path": "/etc/sensors3.conf" | ||
| }, | ||
| "smartctl": { | ||
| "enabled": true | ||
| }, | ||
| "ipmi": { | ||
| "enabled": false | ||
| } | ||
| } | ||
| } | ||
| } | ||
| ``` | ||
|
|
||
| ## GraphQL API | ||
|
|
||
| ### Query: `metrics` -> `temperature` | ||
|
|
||
| Returns a snapshot of the current temperature metrics. | ||
|
|
||
| ```graphql | ||
| query { | ||
| metrics { | ||
| temperature { | ||
| id | ||
| summary { | ||
| average | ||
| hottest { | ||
| name | ||
| current { value unit } | ||
| } | ||
| } | ||
| sensors { | ||
| id | ||
| name | ||
| type | ||
| current { | ||
| value | ||
| unit | ||
| status | ||
| } | ||
| history { | ||
| value | ||
| timestamp | ||
| } | ||
| } | ||
| } | ||
| } | ||
| } | ||
| ``` | ||
|
|
||
| ### Subscription: `systemMetricsTemperature` | ||
|
|
||
| Subscribes to temperature updates (pushed at `polling_interval`). | ||
|
|
||
| ```graphql | ||
| subscription { | ||
| systemMetricsTemperature { | ||
| summary { | ||
| average | ||
| } | ||
| sensors { | ||
| name | ||
| current { | ||
| value | ||
| } | ||
| } | ||
| } | ||
| } | ||
| ``` | ||
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I wasn't sure where to put these docs, so I put it here for now. Let me know if that should change.