How to show CPU load gauge

I’m using Linux Host Metrics | Bases layout for dashboard to manage my ubuntu server with Grafana Cloud. Somehow I cannot show my CPU Load percentage on the CPU Load gauge.
Is there anyone who had this issue and knows how to fix that?

Hi Vu,

Are those VMs or Physical Machines? If they are VMs what hypervisor/Cloud environment do they live on?

1 Like

@aaronshifflett doesnt matter…
@vunh1 could you show how you define/the definition of CPU Load gauge? Click graph ( gauge ) title > Edit; or hold your mouse on the gauge and hit e

1 Like

@anon68762149 is does matter for some niche virtualization tools like older versions of VirtualBox and some versions of Gnome Boxes. However, the query will definitely help.

2 Likes

@aaronshifflett i assumed ( let’s hope rightly ) that @vunh1 has his systems updated.

1 Like

Hi, sorry I forgot to check my thread. I’m still having this issue. Currently, I’m running it on a Physical Machines.

Thanks for your idea, you mean this one, Sorry I’m not sure because I don’t have anything like Edit on my CPU Load title.

1 Like

@vunh1 yes. Exactly the one I was asking for…
TBH I copied yours, modified datasource and nice gauge showed up. So its working :slight_smile:

True. @vunh1 could you please PPM on your graph, but this time select Inspect > Query? Many thanks

1 Like

Here is my Inspect with Query.

1 Like

@vunh1 could you please expand everything under Request? Thanks

1 Like
{
  "request": {
    "url": "api/ds/query",
    "method": "POST",
    "data": {
      "queries": [
        {
          "expr": "1 - avg(irate(node_cpu_seconds_total{mode=\"idle\",instance=~\"avn01:12345\"}[5m]))",
          "legendFormat": "",
          "interval": "",
          "exemplar": true,
          "format": "time_series",
          "instant": false,
          "intervalFactor": 1,
          "refId": "A",
          "datasource": {
            "uid": "grafanacloud-prom",
            "type": "prometheus"
          },
          "queryType": "timeSeriesQuery",
          "requestId": "34A",
          "utcOffsetSec": 25200,
          "datasourceId": 12,
          "intervalMs": 60000,
          "maxDataPoints": 100
        }
      ],
      "range": {
        "from": "2022-02-24T10:06:17.430Z",
        "to": "2022-02-24T11:06:17.430Z",
        "raw": {
          "from": "now-1h",
          "to": "now"
        }
      },
      "from": "1645697177430",
      "to": "1645700777430"
    },
    "hideFromInspector": false
  },
  "response": {
    "results": {
      "A": {
        "frames": [
          {
            "schema": {
              "name": "1 - avg(irate(node_cpu_seconds_total{mode=\"idle\",instance=~\"avn01:12345\"}[5m]))",
              "refId": "A",
              "meta": {
                "custom": {
                  "resultType": "matrix"
                }
              },
              "fields": [
                {
                  "name": "Time",
                  "type": "time",
                  "typeInfo": {
                    "frame": "time.Time"
                  },
                  "config": {
                    "interval": 60000
                  }
                },
                {
                  "name": "Value",
                  "type": "number",
                  "typeInfo": {
                    "frame": "float64",
                    "nullable": true
                  },
                  "labels": {},
                  "config": {
                    "displayNameFromDS": "1 - avg(irate(node_cpu_seconds_total{mode=\"idle\",instance=~\"avn01:12345\"}[5m]))"
                  }
                }
              ]
            },
            "data": {
              "values": [
                [
                  1645697160000,
                  1645697220000,
                  1645697280000,
                  1645697340000,
                  1645697400000,
                  1645697460000,
                  1645697520000,
                  1645697580000,
                  1645697640000,
                  1645697700000,
                  1645697760000,
                  1645697820000,
                  1645697880000,
                  1645697940000,
                  1645698000000,
                  1645698060000,
                  1645698120000,
                  1645698180000,
                  1645698240000,
                  1645698300000,
                  1645698360000,
                  1645698420000,
                  1645698480000,
                  1645698540000,
                  1645698600000,
                  1645698660000,
                  1645698720000,
                  1645698780000,
                  1645698840000,
                  1645698900000,
                  1645698960000,
                  1645699020000,
                  1645699080000,
                  1645699140000,
                  1645699200000,
                  1645699260000,
                  1645699320000,
                  1645699380000,
                  1645699440000,
                  1645699500000,
                  1645699560000,
                  1645699620000,
                  1645699680000,
                  1645699740000,
                  1645699800000,
                  1645699860000,
                  1645699920000,
                  1645699980000,
                  1645700040000,
                  1645700100000,
                  1645700160000,
                  1645700220000,
                  1645700280000,
                  1645700340000,
                  1645700400000,
                  1645700460000,
                  1645700520000,
                  1645700580000,
                  1645700640000,
                  1645700700000,
                  1645700760000
                ],
                [
                  0.03445833333244075,
                  0.03818750000015525,
                  0.032770833332324445,
                  0.03039583333593332,
                  0.030958333332091525,
                  0.030937499999223905,
                  0.03443749999957313,
                  0.030479166667403912,
                  0.03127083333286762,
                  0.030750000001474653,
                  0.03174999999949557,
                  0.03431250000042674,
                  0.031208333335234872,
                  0.03014583333084986,
                  0.031083333334148255,
                  0.030562499999844728,
                  0.03456249999968952,
                  0.03079166666623978,
                  0.030979166666899483,
                  0.03056250000081495,
                  0.03149999999926267,
                  0.03479166666705469,
                  0.03131250000054331,
                  0.0304166666658906,
                  0.03120833333232431,
                  0.031375000001086506,
                  0.03527083333368264,
                  0.03172916666662795,
                  0.031854166667714456,
                  0.031229166665192043,
                  0.03170833333376022,
                  0.03387499999953436,
                  0.030791666667209894,
                  0.03135416666627855,
                  0.031187499999456803,
                  0.03200000000069847,
                  0.03525000000081491,
                  0.03152083333310052,
                  0.03160416666554133,
                  0.032354166667209916,
                  0.03220833333325568,
                  0.03647916666523077,
                  0.031895833336360035,
                  0.030812499997167175,
                  0.03147916666736528,
                  0.03097916666883982,
                  0.03468749999786569,
                  0.03222916666709352,
                  0.0318958333334497,
                  0.030916666667326398,
                  0.03058333333271246,
                  0.03450000000108655,
                  0.03266666666507578,
                  0.032145833333682594,
                  0.03262499999934032,
                  0.03147916666639505,
                  0.03491666666620097,
                  0.031000000002677552,
                  0.030541666665036993,
                  0.030729166668606922,
                  0.030874999997710484
                ]
              ]
            }
          },
          {
            "schema": {
              "name": "exemplar",
              "refId": "A",
              "meta": {
                "custom": {
                  "resultType": "exemplar"
                }
              },
              "fields": [
                {
                  "name": "Time",
                  "type": "time",
                  "typeInfo": {
                    "frame": "time.Time"
                  }
                },
                {
                  "name": "Value",
                  "type": "number",
                  "typeInfo": {
                    "frame": "float64"
                  }
                }
              ]
            },
            "data": {
              "values": [
                [],
                []
              ]
            }
          }
        ],
        "refId": "A"
      }
    }
  }
}

Here it is sir

1 Like

This may be the reason of graph not showing values: intewrval is empty; so it gets parsed as 0. Meaning: “do not show any value.”

Set it to 30000.30000ms = 3sec. Optimal setting.

All the editing is done via JSON tab. After editing JSON, dont forget to click Apply

Tks for your hardwork but I tried to change that value but it will be reset to empty everytime I refresh.

1 Like

@vunh1 if so, than please make sure that Grafana has write access to files.

1 Like