- Cyberpunk-themed Unraid dashboard - Disk usage monitoring with ring charts - System metrics (CPU, Memory, Parity) - Docker container status display - Optimized for Raspberry Pi 3 - GraphQL API integration 🤖 Generated with Claude Code (https://claude.com/claude-code) Co-Authored-By: Claude <noreply@anthropic.com>
10 KiB
Unraid GraphQL Schema Findings
Investigation Date
2025-11-22
Server Information
- Server URL: http://192.168.2.61:81/graphql
- Authentication: API Key via
x-api-keyheader
Schema Exploration Process
This document contains our findings from systematically exploring the Unraid GraphQL API schema to identify the correct fields and types for retrieving system information.
Type: Info
The root Info type contains various system information categories.
Available Fields
{
"__type": {
"name": "Info",
"fields": [
{ "name": "id", "type": { "name": null } },
{ "name": "time", "type": { "name": null } },
{ "name": "baseboard", "type": { "name": null } },
{ "name": "cpu", "type": { "name": null } },
{ "name": "devices", "type": { "name": null } },
{ "name": "display", "type": { "name": null } },
{ "name": "machineId", "type": { "name": "ID" } },
{ "name": "memory", "type": { "name": null } },
{ "name": "os", "type": { "name": null } },
{ "name": "system", "type": { "name": null } },
{ "name": "versions", "type": { "name": null } }
]
}
}
Field Descriptions
id- Identifiertime- Time information (unknown structure)baseboard- Motherboard informationcpu- CPU hardware informationdevices- Connected devicesdisplay- Display/graphics informationmachineId- Machine identifier (returns ID scalar)memory- Memory hardware information (NOT usage statistics)os- Operating system informationsystem- System information (potentially contains usage stats - needs investigation)versions- Version information
Type: InfoMemory
The InfoMemory type describes physical RAM hardware, NOT runtime memory usage.
Available Fields
{
"__type": {
"name": "InfoMemory",
"fields": [
{ "name": "id", "type": { "name": null, "kind": "NON_NULL" } },
{ "name": "layout", "type": { "name": null, "kind": "NON_NULL" } }
]
}
}
Field Details
id- Memory identifier (required)layout- Array ofMemoryLayoutobjects (required)- Type:
[MemoryLayout!]!
- Type:
Important Note
This type does NOT contain the fields we initially attempted to query:
- ❌
total- Does not exist - ❌
free- Does not exist - ❌
used- Does not exist
These field names were incorrectly assumed based on documentation examples.
Type: MemoryLayout
Physical RAM module information (hardware specs, not usage).
Available Fields
{
"__type": {
"name": "MemoryLayout",
"fields": [
{ "name": "id", "type": { "name": null, "kind": "NON_NULL" } },
{ "name": "size", "type": { "name": null, "kind": "NON_NULL" } },
{ "name": "bank", "type": { "name": "String", "kind": "SCALAR" } },
{ "name": "type", "type": { "name": "String", "kind": "SCALAR" } },
{ "name": "clockSpeed", "type": { "name": "Int", "kind": "SCALAR" } },
{ "name": "partNum", "type": { "name": "String", "kind": "SCALAR" } },
{ "name": "serialNum", "type": { "name": "String", "kind": "SCALAR" } },
{ "name": "manufacturer", "type": { "name": "String", "kind": "SCALAR" } },
{ "name": "formFactor", "type": { "name": "String", "kind": "SCALAR" } },
{ "name": "voltageConfigured", "type": { "name": "Int", "kind": "SCALAR" } },
{ "name": "voltageMin", "type": { "name": "Int", "kind": "SCALAR" } },
{ "name": "voltageMax", "type": { "name": "Int", "kind": "SCALAR" } }
]
}
}
Field Descriptions
id- Module identifier (required)size- RAM module size in bytes (required)bank- Memory bank location (e.g., "BANK 0")type- RAM type (e.g., "DDR4", "DDR5")clockSpeed- Operating frequency in MHzpartNum- Part numberserialNum- Serial numbermanufacturer- Manufacturer nameformFactor- Physical form factor (e.g., "DIMM")voltageConfigured- Configured voltagevoltageMin- Minimum voltagevoltageMax- Maximum voltage
Usage Example
query {
info {
memory {
id
layout {
size
bank
type
manufacturer
}
}
}
}
Purpose
This type provides hardware inventory information about installed RAM modules. It can be used to:
- Calculate total installed RAM (sum of all
sizefields) - Display RAM configuration
- Show hardware specifications
However, it does NOT provide:
- Current memory usage
- Available memory
- Memory utilization percentage
✅ RESOLVED: Runtime Statistics Location
Memory and CPU Usage Data
Location Found: metrics query root
Type: Metrics
The Metrics type provides real-time system utilization data.
Query Structure:
query {
metrics {
cpu {
percentTotal
cpus {
percentTotal
percentUser
percentSystem
percentIdle
}
}
memory {
total
used
free
available
percentTotal
swapTotal
swapUsed
swapFree
percentSwapTotal
}
}
}
CpuUtilization Fields
percentTotal- Overall CPU usage percentage (what we need for dashboard)cpus- Array of per-core CPU loads
MemoryUtilization Fields
total- Total system memory in bytesused- Used memory in bytesfree- Free memory in bytesavailable- Available memory in bytespercentTotal- Memory usage percentage (what we need for dashboard)swapTotal- Total swap memoryswapUsed- Used swap memoryswapFree- Free swap memorypercentSwapTotal- Swap usage percentage
Required Introspection Queries
To continue investigation, run these queries:
1. List all available types:
query {
__schema {
types {
name
kind
}
}
}
2. Investigate InfoSystem type:
query {
__type(name: "InfoSystem") {
name
fields {
name
type {
name
kind
}
}
}
}
3. Search for stats-related types: Look through the full type list for names containing:
- Stats
- Metrics
- Usage
- Monitor
- Performance
- Resource
Array Type Information
Status
The array query successfully returns basic state information.
Working Query:
query {
array {
state
}
}
Fields to Investigate
Based on earlier attempts, we know:
array.state- Works (returns array state)array.capacity.disks- Containsfree,used,totalfieldsarray.disks- Containsname,size,status,tempfields
Need to verify:
- Exact structure of
capacityfield - Whether disk arrays are parallel (same index = same disk)
- Parity information location
Docker Container Information
Status
Docker container queries appear to work.
Working Query:
query {
dockerContainers {
names
state
}
}
Available Fields (from earlier attempts)
id- Container IDnames- Container names (array)state- Container state (running/stopped/etc.)status- Status stringautoStart- Auto-start configuration
Note: This query succeeded in earlier tests. Docker integration appears functional.
Error Patterns Observed
Pattern 1: Field Does Not Exist
{
"message": "Cannot query field \"fieldName\" on type \"TypeName\"."
}
Cause: Field name is incorrect or does not exist in schema.
Solution: Use introspection to discover actual field names.
Pattern 2: Missing Subfield Selection
{
"message": "Field \"fieldName\" of type \"[Type!]!\" must have a selection of subfields."
}
Cause: Field returns a complex object/array but no subfields were specified.
Solution: Query reveals the return type - use introspection to find available subfields.
Pattern 3: Syntax Error
{
"message": "Syntax Error: Expected Name, found ."
}
Cause: Query has syntax error (extra characters, malformed structure).
Solution: Verify query syntax, check for copy-paste issues.
Introspection Capabilities
Confirmed Working
__type(name: "TypeName")- Retrieve specific type information__typename- Get runtime type name- Field type introspection with nested
ofType
Not Yet Tested
__schema { types }- Full schema type listqueryType/mutationType- Root operation types- Subscription support
Next Steps
- ✅ Run
__schema { types }query to see all available types - ⏳ Locate memory usage statistics type
- ⏳ Locate CPU usage statistics type
- ⏳ Verify array and disk query structure
- ⏳ Find parity status information
- ⏳ Document complete working queries for all dashboard data
- ⏳ Update dashboard JavaScript with correct queries
Tools Used
- schema-test.html - Custom introspection and query testing tool
- Located at:
/Users/michaelsimard/dev/web/unraid-dash/schema-test.html - Features: Introspection queries, custom query execution, preset tests, copy-to-clipboard
- Located at:
References
- Unraid API Documentation
- GraphQL Introspection Specification
- Project Summary:
PROJECT_SUMMARY.md
Final Working Queries for Dashboard
Complete System Metrics Query
query {
metrics {
cpu {
percentTotal
}
memory {
total
used
free
percentTotal
}
}
}
Complete Array and Disk Query
query {
array {
state
capacity {
disks {
free
used
total
}
}
disks {
name
size
status
temp
}
parityCheckStatus {
status
errors
date
}
}
}
Complete Docker Containers Query
query {
docker {
containers {
id
names
state
status
autoStart
}
}
}
Last Updated: 2025-11-22 Status: ✅ COMPLETE - All required queries identified and working Next Action: Test dashboard with real Unraid server data