Skip to content
View in the app

A better way to browse. Learn more.

Unraid

A full-screen app on your home screen with push notifications, badges and more.

To install this app on iOS and iPadOS
  1. Tap the Share icon in Safari
  2. Scroll the menu and tap Add to Home Screen.
  3. Tap Add in the top-right corner.
To install this app on Android
  1. Tap the 3-dot menu (⋮) in the top-right corner of the browser.
  2. Tap Add to Home screen or Install app.
  3. Confirm by tapping Install.

help to access http://tower.local/graphql endpoint to retrieve system metrics

Featured Replies

I've been attempting to query Unraid's api for the past few days. My use case is to retrieve metrics for a grafana dashboard. I see there are some attempts to create an api for Unraid (e.g ElectricBrainUK's Unraid-API docker available in the CA). But I'm wondering if anyone has successfully used the official unraid-api implemented by the My Servers plugin to gather metrics from their own server?

It uses graphql instead of the more well know REST-API.

I'm part way there but I'm hoping someone with more experience than me can provide some concrete examples of how to authenticate and then get real information from a query.

 

I finally stumbled across some information in 

/usr/local/bin/unraid-api/README.md

and was able to find my api-key here: 

/boot/config/plugins/dynamix.my.servers/myservers.cfg

 Using the information in these, I enabled the graphQL playground at http://tower.local/graphql by restarting the unraid-api in debug mode (unraid-api restart -d) and then visiting the "/graphql" endpoint of my server. Tons of information in the graphql playground at that url, including the entire api schema and documentation. Unfortunately I'm not experienced enough with GraphQL to put 2 and 2 together to get what I need. 

So far I can query the endpoint with:

query welcome {
  welcome {
    message
  }
}

 

and get back:

{
  "data": {
    "welcome": {
      "message": "Welcome my_servers to this Unraid 6.10.0 server"
    }
  }
}

 

but anything else I try requires authentication - which I haven't yet cracked. E.g. see below

 

query Info {
  info{
    os {uptime
    }
  }
}

 results in:

{
  "errors": [
    {
      "message": "my_servers doesn't have permission to access \"os\".",
      "locations": [
        {
          "line": 3,
          "column": 5
        }
      ],
      "path": [
        "info",
        "os"
      ],
      "extensions": {
        "code": "INTERNAL_SERVER_ERROR"
      }
    }
  ],
  "data": {
    "info": {
      "os": null
    }
  }
}

 

I guess that's because the api-key I'm using and sending in the HTTP header is one that is generated by the "my_servers" user. But how to generate one that I can query my own  server with? Or maybe I've got the wrong end of the stick and I can't actually use this to do what I want?

 

Any help appreciated!

Cheers

 

Our goal is to open this up to folks but we aren't ready yet.

  • 10 months later...
On 5/19/2022 at 9:21 PM, ljm42 said:

Our goal is to open this up to folks but we aren't ready yet.

 

Is there any update on this? I would love to use this for some projects

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Reply to this topic...

Account

Navigation

Search

Search

Configure browser push notifications

Chrome (Android)
  1. Tap the lock icon next to the address bar.
  2. Tap Permissions → Notifications.
  3. Adjust your preference.
Chrome (Desktop)
  1. Click the padlock icon in the address bar.
  2. Select Site settings.
  3. Find Notifications and adjust your preference.