Repository navigation
Feature: read System Summary figures from the Unraid API - #125
Merged
Merged
Conversation
Adds Unraid as a source alongside Beszel, Glances and the local machine. One GraphQL query returns CPU and memory utilisation, temperatures by sensor name, and the boot time that becomes the uptime. A disk slot names a user share, or is left empty for the array as a whole. Neither IO wait nor a process count exists anywhere in the schema, so the slot does not offer them. Shares and the array sit behind their own permissions, so they are only asked for when a slot needs them, and a key limited to metrics still works. Sensor readings are converted to Celsius, since the API reports whichever unit the server is set to. Temperature reporting ships disabled and resolves to null rather than failing, so the picker names that instead of showing no sensors.
…s them A share's size field is its own limit and is 0 unless one is set, so a share was measured against nothing and always read as empty. What is used plus what is left on the pool is the only total available, and is now the fallback. An API key the server refuses does not produce a 401. The request succeeds and the rejection arrives as a GraphQL error, so the status code alone never reports it. The error's own code now decides, covering both a refused key and a key whose role does not reach the resource.
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
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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.
Summary
unraidtostatProvider, withunraidUrland anunraidApiKeysecret.slotsgroup: no IO Wait and no Processes, since neither exists in the schema, share-name labels for the two disk fields, and a group hint naming what the source does not report./graphqlwith anx-api-keyheader, building it from the slots in use sosharesandarrayare only requested when a slot needs them.metrics.cpu.percentTotalandmetrics.memory.percentTotal,metrics.temperature.sensorsby name, a user share or the array capacity for a disk slot, andinfo.os.uptimeas a boot time converted to elapsed seconds.errorsentry as written, classifying it by its ownextensions.code, since neither a refused key nor an insufficient role produces a 401.Reading a machine from the dashboard running beside it is most useful where Stackyard is installed on the machine itself, which is how the Unraid Community Applications install runs it.
Testing
All green, including the Docker build. Added 12 tests for the provider, covering the request shape, slot mapping, unit conversion, share versus array, a share with no size limit, boot-time arithmetic, conditional query building, and each failure kind.
Verified end to end against Unraid's own API server, run from the
unraid/apidevelopment image with its state fixtures, using a key issued by its own CLI. That run corrected two things a schema reading had wrong: a share reportssizeas its limit, which is0unless one is set, and a refused key returns200with a GraphQL error rather than401. Confirmed live: CPU and memory, uptime from boot time, a named share, the array total, an unknown share reading empty, temperature resolving to null with reporting disabled, a refused key, and a key whose role does not reach the resource.Checklist