Grafana: Graph - Noise Range: Unterschied zwischen den Versionen
Aus Wiki-WebPerfect
Admin (Diskussion | Beiträge) |
Admin (Diskussion | Beiträge) |
||
(Eine dazwischenliegende Version des gleichen Benutzers werden nicht angezeigt) | |||
Zeile 1: | Zeile 1: | ||
− | If you want a Grafana Graph that shows the average CPU usage as a line but also the min and max value as a area in the background, then following this site. <br> | + | If you want a Grafana Graph that shows the '''average CPU usage''' as a line but also the '''min''' and '''max''' value as a area in the background for example like the image below, then following this site. <br> |
[[Datei:01-noise range.png|1200px]] <br> | [[Datei:01-noise range.png|1200px]] <br> | ||
+ | === Example Flux Query === | ||
+ | The image above is based on the following Flux query: | ||
+ | <pre> | ||
+ | //define variables | ||
+ | bucket = "telegraf" | ||
+ | |||
+ | data = from(bucket: bucket) | ||
+ | |> range(start: v.timeRangeStart, stop: v.timeRangeStop) | ||
+ | |> filter(fn: (r) => | ||
+ | r._measurement == "hyperv_logical_processor" and | ||
+ | r._field == "Percent_Total_Run_Time" | ||
+ | ) | ||
+ | |> group(columns: ["instance"]) | ||
+ | |||
+ | |||
+ | mean = data | ||
+ | |> aggregateWindow(every: 10m, fn: mean, createEmpty: false) | ||
+ | |> set(key: "_field", value: "mean") | ||
+ | |||
+ | min = data | ||
+ | |> aggregateWindow(every: 10m, fn: min, createEmpty: false) | ||
+ | |> set(key: "_field", value: "min") | ||
+ | |||
+ | max = data | ||
+ | |> aggregateWindow(every: 10m, fn: max, createEmpty: false) | ||
+ | |> set(key: "_field", value: "max") | ||
+ | |||
+ | union(tables: [mean, min, max]) | ||
+ | |> pivot(rowKey:["_time"], columnKey: ["_field"], valueColumn: "_value") | ||
+ | |> keep(columns: ["_time", "instance", "mean", "min", "max"]) | ||
+ | </pre> | ||
+ | |||
+ | |||
+ | === Grafana settings === | ||
+ | For the visualization like the image above, you have to settings in the "Graph styles" like in the image above + the "Overrides" from the following image: <br> | ||
+ | [[Datei:01-noise range-overrides.png]] | ||
Aktuelle Version vom 16. September 2021, 13:32 Uhr
If you want a Grafana Graph that shows the average CPU usage as a line but also the min and max value as a area in the background for example like the image below, then following this site.
Example Flux Query
The image above is based on the following Flux query:
//define variables bucket = "telegraf" data = from(bucket: bucket) |> range(start: v.timeRangeStart, stop: v.timeRangeStop) |> filter(fn: (r) => r._measurement == "hyperv_logical_processor" and r._field == "Percent_Total_Run_Time" ) |> group(columns: ["instance"]) mean = data |> aggregateWindow(every: 10m, fn: mean, createEmpty: false) |> set(key: "_field", value: "mean") min = data |> aggregateWindow(every: 10m, fn: min, createEmpty: false) |> set(key: "_field", value: "min") max = data |> aggregateWindow(every: 10m, fn: max, createEmpty: false) |> set(key: "_field", value: "max") union(tables: [mean, min, max]) |> pivot(rowKey:["_time"], columnKey: ["_field"], valueColumn: "_value") |> keep(columns: ["_time", "instance", "mean", "min", "max"])
Grafana settings
For the visualization like the image above, you have to settings in the "Graph styles" like in the image above + the "Overrides" from the following image: