Forum Discussion

yaquaholic's avatar
yaquaholic
Icon for Contributor III rankContributor III
5 months ago
Solved

GraphQL Query

Good afternoon,

I've been tasked with extracting performance data, for quarterly customer reviews, and after many hours of PowerBI M Query and trying to wrangle the data into a useable form - I still can't.
When I remembered that with GQL we can extract only what we need. 
However I've spent another few unsuccessful hours trying to find the connection between the devices and their performance data. 

This is as far I have I got:

query DeviceByOrgID {
  devices(search: {organization: {has: {id: {eq: "39"}}}}) {
    edges {
      node {
        id
        name
        ip
        componentChildren{edges{node {id}}}
        deviceClass {
          description
          class}
       }
    } 
  }
}

Could anyone show me how to extract some performance data for a device, CPU normalized hourly for example, using GQL?
Even if it's just for a single device.

Thanks

  • Hi - You can try this.

    query MyQuery {
      devices {
        edges {
          node {
            id
            ip
            name
            metrics(collection: {id: "cpu", duration: "2d", rollupFreq: hourly}) {
              info {
                label
                units {
                  label
                }
              }
              values {
                edges {
                  cursor
                  node
                }
              }
            }
          }
        }
      }
    }

6 Replies

  • Hi - You can try this.

    query MyQuery {
      devices {
        edges {
          node {
            id
            ip
            name
            metrics(collection: {id: "cpu", duration: "2d", rollupFreq: hourly}) {
              info {
                label
                units {
                  label
                }
              }
              values {
                edges {
                  cursor
                  node
                }
              }
            }
          }
        }
      }
    }

    • yaquaholic's avatar
      yaquaholic
      Icon for Contributor III rankContributor III

      For testing purposes just remove the /ap2 or /em7 from your SL1 URL and replace it with /gql.

      There used to be some good docs on this, but they have not been updated since v11.3 and are not showing on the support site as they are EoL. 😟

  • yaquaholic's avatar
    yaquaholic
    Icon for Contributor III rankContributor III

    Or the GQL Browser page (System > Tools > GQL Browser), built into SL1 versions 12.3.0 and later.

  • yaquaholic's avatar
    yaquaholic
    Icon for Contributor III rankContributor III

    And the docs for this are now on the SL Support Site (https://support.sciencelogic.com/s) under the Documentation drop down.