13 Commits

Author SHA1 Message Date
93402deb00 print help when -h is present regardless of other flags 2025-10-25 22:15:24 +02:00
de05ca6c6c revert 2025-10-24 11:11:39 +02:00
ff125805be test png 2025-10-24 11:09:35 +02:00
6fc12f6ea7 add grafana dashboard 2025-10-24 11:08:34 +02:00
c1199931ee log errors to error channel, not debug 2025-10-23 20:08:10 +02:00
903401f511 add badges to readme 2025-10-23 17:48:36 +02:00
fdb4090a6e fix #5: nobody understands context deadline exceeded, use timeout 2025-10-23 17:42:05 +02:00
d46b731f06 fix #4: do not compare read+write block on failure 2025-10-23 17:37:34 +02:00
ca19721084 fix #6: do not report elapsed time on failure 2025-10-23 17:32:37 +02:00
b48ea00b22 oops 2025-10-23 12:59:54 +02:00
ad80542619 return wg pointer 2025-10-23 12:41:34 +02:00
62f5b51be8 add waitgroup for goroutine 1 2025-10-23 12:39:09 +02:00
T.v.Dein
99222b1cae Refactor exporter (#3)
* refactor exporter code for better readability and structure
* modified startup log output a little
2025-10-23 12:14:33 +02:00
8 changed files with 726 additions and 75 deletions

View File

@@ -1,3 +1,7 @@
[![Actions](https://github.com/tlinden/io-exporter/actions/workflows/ci.yaml/badge.svg)](https://github.com/tlinden/io-exporter/actions)
[![License](https://img.shields.io/badge/license-GPL-blue.svg)](https://github.com/tlinden/io-exporter/blob/master/LICENSE)
[![Go Report Card](https://goreportcard.com/badge/github.com/tlinden/io-exporter)](https://goreportcard.com/report/github.com/tlinden/io-exporter)
# io-exporter # io-exporter
Report if a given filesystem is operating properly Report if a given filesystem is operating properly
@@ -87,6 +91,15 @@ Or use the pre-build image:
docker run -u `id -u $USER` -v ./t:/pvc ghcr.io/tlinden/io-exporter:latest /pvc/testfile docker run -u `id -u $USER` -v ./t:/pvc ghcr.io/tlinden/io-exporter:latest /pvc/testfile
``` ```
## Grafana
I provide a [sample dashboard](grafana), which you can add to your grafana or use
as a starting point to integrate it into your monitoring setup.
It looks like this:
![Screenshot](https://github.com/TLINDEN/io-exporter/blob/main/grafana/screenshot.png)
# Report bugs # Report bugs
[Please open an issue](https://github.com/TLINDEN/io-exporter/issues). Thanks! [Please open an issue](https://github.com/TLINDEN/io-exporter/issues). Thanks!

1
blah
View File

@@ -1 +0,0 @@
AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA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AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA

View File

@@ -15,7 +15,7 @@ import (
) )
const ( const (
Version = `v0.0.5` Version = `v0.0.8`
SLEEP = 5 SLEEP = 5
Usage = `io-exporter [options] <file> Usage = `io-exporter [options] <file>
Options: Options:

View File

@@ -6,38 +6,101 @@ import (
"io" "io"
"log/slog" "log/slog"
"os" "os"
"sync"
"time" "time"
"github.com/ncw/directio" "github.com/ncw/directio"
) )
func report(err error, fd *os.File) bool { // our primary container for the io checks
slog.Debug("failed to check io", "error", err) type Exporter struct {
conf *Config
if fd != nil { alloc *Alloc
if err := fd.Close(); err != nil { metrics *Metrics
slog.Debug("failed to close filehandle", "error", err)
}
}
return false
} }
// Calls runcheck* with timeout type Result struct {
func runExporter(file string, alloc *Alloc, timeout time.Duration, op int) bool { result bool
elapsed float64
}
func NewExporter(conf *Config, alloc *Alloc, metrics *Metrics) *Exporter {
return &Exporter{
conf: conf,
alloc: alloc,
metrics: metrics,
}
}
// starts the primary go-routine, which will run the io checks for ever
func (exp *Exporter) RunIOchecks() *sync.WaitGroup {
var wg sync.WaitGroup
wg.Add(1)
go func() {
for {
var res_r, res_w Result
exp.alloc.Clean()
if exp.conf.WriteMode {
res_w = exp.measure(O_W)
slog.Debug("elapsed write time", "elapsed", res_w.elapsed, "result", res_w.result)
}
if exp.conf.ReadMode {
res_r = exp.measure(O_R)
slog.Debug("elapsed read time", "elapsed", res_r.elapsed, "result", res_r.result)
}
if (exp.conf.WriteMode && exp.conf.ReadMode) && (res_r.result && res_w.result) {
if !exp.alloc.Compare() {
res_r.result = false
}
}
exp.metrics.Set(res_r, res_w)
time.Sleep(time.Duration(exp.conf.Sleeptime) * time.Second)
}
}()
return &wg
}
// call an io measurement and collect time needed
func (exp *Exporter) measure(mode int) Result {
start := time.Now()
result := exp.runExporter(mode)
// ns => s
now := time.Now()
elapsed := float64(now.Sub(start).Nanoseconds()) / 10000000000
// makes no sense to measure latency if operation failed
if !result {
elapsed = 0
}
return Result{elapsed: elapsed, result: result}
}
// Calls runcheck's with context timeout
func (exp *Exporter) runExporter(mode int) bool {
ctx := context.Background() ctx := context.Background()
ctx, cancel := context.WithTimeout(ctx, timeout) ctx, cancel := context.WithTimeout(ctx, time.Duration(exp.conf.Timeout)*time.Second)
defer cancel() defer cancel()
run := make(chan struct{}, 1) run := make(chan struct{}, 1)
var res bool var res bool
go func() { go func() {
switch op { switch mode {
case O_R: case O_R:
res = runcheck_r(file, alloc) res = exp.runcheck_r()
case O_W: case O_W:
res = runcheck_w(file, alloc) res = exp.runcheck_w()
} }
run <- struct{}{} run <- struct{}{}
}() }()
@@ -60,19 +123,19 @@ func runExporter(file string, alloc *Alloc, timeout time.Duration, op int) bool
// //
// Returns false if anything failed during that sequence, // Returns false if anything failed during that sequence,
// true otherwise. // true otherwise.
func runcheck_r(file string, alloc *Alloc) bool { func (exp *Exporter) runcheck_r() bool {
// read // read
in, err := directio.OpenFile(file, os.O_RDONLY, 0640) in, err := directio.OpenFile(exp.conf.File, os.O_RDONLY, 0640)
if err != nil { if err != nil {
report(err, nil) report(err, nil)
} }
n, err := io.ReadFull(in, alloc.readBlock) n, err := io.ReadFull(in, exp.alloc.readBlock)
if err != nil { if err != nil {
return report(err, in) return report(err, in)
} }
if n != len(alloc.writeBlock) { if n != len(exp.alloc.writeBlock) {
return report(errors.New("failed to read block"), in) return report(errors.New("failed to read block"), in)
} }
@@ -92,23 +155,23 @@ func runcheck_r(file string, alloc *Alloc) bool {
// //
// Returns false if anything failed during that sequence, // Returns false if anything failed during that sequence,
// true otherwise. // true otherwise.
func runcheck_w(file string, alloc *Alloc) bool { func (exp *Exporter) runcheck_w() bool {
// write // write
fd, err := directio.OpenFile(file, os.O_RDWR|os.O_TRUNC|os.O_CREATE, 0640) fd, err := directio.OpenFile(exp.conf.File, os.O_RDWR|os.O_TRUNC|os.O_CREATE, 0640)
if err != nil { if err != nil {
report(err, nil) report(err, nil)
} }
for i := 0; i < len(alloc.writeBlock); i++ { for i := 0; i < len(exp.alloc.writeBlock); i++ {
alloc.writeBlock[i] = 'A' exp.alloc.writeBlock[i] = 'A'
} }
n, err := fd.Write(alloc.writeBlock) n, err := fd.Write(exp.alloc.writeBlock)
if err != nil { if err != nil {
return report(err, fd) return report(err, fd)
} }
if n != len(alloc.writeBlock) { if n != len(exp.alloc.writeBlock) {
return report(errors.New("failed to write block"), fd) return report(errors.New("failed to write block"), fd)
} }

View File

@@ -101,25 +101,25 @@ func NewMetrics(conf *Config) *Metrics {
return metrics return metrics
} }
func (metrics *Metrics) Set(result_r, result_w bool, elapsed_r, elapsed_w float64) { func (metrics *Metrics) Set(result_r, result_w Result) {
var res float64 var res float64
switch metrics.mode { switch metrics.mode {
case O_RW: case O_RW:
if result_r && result_w { if result_r.result && result_w.result {
res = 1 res = 1
} }
case O_R: case O_R:
if result_r { if result_r.result {
res = 1 res = 1
} }
case O_W: case O_W:
if result_w { if result_w.result {
res = 1 res = 1
} }
} }
metrics.run.WithLabelValues(metrics.values...).Set(res) metrics.run.WithLabelValues(metrics.values...).Set(res)
metrics.latency_r.WithLabelValues(metrics.values...).Set(elapsed_r) metrics.latency_r.WithLabelValues(metrics.values...).Set(result_r.elapsed)
metrics.latency_w.WithLabelValues(metrics.values...).Set(elapsed_w) metrics.latency_w.WithLabelValues(metrics.values...).Set(result_w.elapsed)
} }

View File

@@ -7,11 +7,17 @@ import (
"net/http" "net/http"
"os" "os"
"strings" "strings"
"time"
// enable to debug with roumon
//_ "net/http/pprof"
// then: roumon -host=localhost -port=9187
"github.com/prometheus/client_golang/prometheus/promhttp" "github.com/prometheus/client_golang/prometheus/promhttp"
) )
// Main program. starts 2 goroutines: our exporter and the http server
// for the prometheus metrics. The exporter reports measurement
// results to prometheus metrics directly
func Run() { func Run() {
conf, err := InitConfig(os.Stdout) conf, err := InitConfig(os.Stdout)
if err != nil { if err != nil {
@@ -23,62 +29,52 @@ func Run() {
os.Exit(0) os.Exit(0)
} }
metrics := NewMetrics(conf) if conf.Showhelp {
alloc := NewAlloc() fmt.Println(Usage)
os.Exit(0)
}
setLogger(os.Stdout, conf.Debug) setLogger(os.Stdout, conf.Debug)
go func() { metrics := NewMetrics(conf)
for { alloc := NewAlloc()
var result_r, result_w bool exporter := NewExporter(conf, alloc, metrics)
var elapsed_w, elapsed_r float64
alloc.Clean() wg := exporter.RunIOchecks()
if conf.WriteMode {
elapsed_w, result_w = measure(conf.File, alloc, conf.Timeout, O_W)
slog.Debug("elapsed write time", "elapsed", elapsed_w, "result", result_w)
}
if conf.ReadMode {
elapsed_r, result_r = measure(conf.File, alloc, conf.Timeout, O_R)
slog.Debug("elapsed read time", "elapsed", elapsed_r, "result", result_r)
}
if conf.WriteMode && conf.ReadMode {
if !alloc.Compare() {
result_r = false
}
}
metrics.Set(result_r, result_w, elapsed_r, elapsed_w)
time.Sleep(time.Duration(conf.Sleeptime) * time.Second)
}
}()
http.Handle("/metrics", promhttp.HandlerFor( http.Handle("/metrics", promhttp.HandlerFor(
metrics.registry, metrics.registry,
promhttp.HandlerOpts{}, promhttp.HandlerOpts{},
)) ))
slog.Info("start testing and serving metrics on localhost", "port", conf.Port) slog.Info(" ╭──")
slog.Info("test setup", "file", conf.File, "labels", strings.Join(conf.Label, ",")) slog.Info(" │ io-exporter starting up", "version", Version)
slog.Info("measuring", "read", conf.ReadMode, "write", conf.WriteMode, "timeout(s)", conf.Timeout) slog.Info(" │ serving metrics", "host", "localhost", "port", conf.Port)
slog.Info(" │ test setup", "file", conf.File, "labels", strings.Join(conf.Label, ","))
slog.Info(" │ measuring", "read", conf.ReadMode, "write", conf.WriteMode, "timeout(s)", conf.Timeout)
slog.Info(" │ debugging", "enabled", conf.Debug)
slog.Info(" ╰──")
if err := http.ListenAndServe(fmt.Sprintf(":%d", conf.Port), nil); err != nil { if err := http.ListenAndServe(fmt.Sprintf(":%d", conf.Port), nil); err != nil {
log.Fatal(err) log.Fatal(err)
} }
wg.Wait()
} }
func measure(file string, alloc *Alloc, timeout int, mode int) (float64, bool) { func report(err error, fd *os.File) bool {
start := time.Now() failure := err.Error()
if err.Error() == "context deadline exceeded" {
failure = "operation timed out"
}
result := runExporter(file, alloc, time.Duration(timeout)*time.Second, mode) slog.Error("io error", "error", failure)
// ns => s if fd != nil {
now := time.Now() if err := fd.Close(); err != nil {
elapsed := float64(now.Sub(start).Nanoseconds()) / 10000000000
return elapsed, result slog.Debug("failed to close filehandle", "error", failure)
}
}
return false
} }

580
grafana/dashboard.js Normal file
View File

@@ -0,0 +1,580 @@
{
"annotations": {
"list": [
{
"builtIn": 1,
"datasource": {
"type": "grafana",
"uid": "-- Grafana --"
},
"enable": true,
"hide": true,
"iconColor": "rgba(0, 211, 255, 1)",
"name": "Annotations & Alerts",
"type": "dashboard"
}
]
},
"editable": true,
"fiscalYearStartMonth": 0,
"graphTooltip": 0,
"id": 37,
"links": [],
"panels": [
{
"datasource": {
"type": "prometheus",
"uid": "P5DCFC7561CCDE821"
},
"fieldConfig": {
"defaults": {
"color": {
"mode": "thresholds"
},
"custom": {
"fillOpacity": 70,
"hideFrom": {
"legend": false,
"tooltip": false,
"viz": false
},
"insertNulls": false,
"lineWidth": 0,
"spanNulls": false
},
"mappings": [],
"thresholds": {
"mode": "absolute",
"steps": [
{
"color": "green",
"value": null
},
{
"color": "red",
"value": 0
},
{
"color": "green",
"value": 1
}
]
},
"unit": "bool_yes_no"
},
"overrides": []
},
"gridPos": {
"h": 9,
"w": 24,
"x": 0,
"y": 0
},
"id": 4,
"options": {
"alignValue": "left",
"legend": {
"displayMode": "list",
"placement": "bottom",
"showLegend": true
},
"mergeValues": true,
"rowHeight": 0.9,
"showValue": "auto",
"tooltip": {
"mode": "single",
"sort": "none"
}
},
"pluginVersion": "11.3.8+security-01",
"targets": [
{
"editorMode": "code",
"expr": "sum(io_exporter_io_operation{container=\"ioexporter\",namespace=\"$namespace\"}) by (pod)",
"legendFormat": "{{pod}}",
"range": true,
"refId": "A"
}
],
"title": "IO Operation Result",
"type": "state-timeline"
},
{
"datasource": {
"type": "prometheus",
"uid": "P5DCFC7561CCDE821"
},
"fieldConfig": {
"defaults": {
"color": {
"mode": "palette-classic"
},
"custom": {
"axisBorderShow": false,
"axisCenteredZero": false,
"axisColorMode": "text",
"axisLabel": "",
"axisPlacement": "auto",
"barAlignment": 0,
"barWidthFactor": 0.6,
"drawStyle": "line",
"fillOpacity": 0,
"gradientMode": "none",
"hideFrom": {
"legend": false,
"tooltip": false,
"viz": false
},
"insertNulls": false,
"lineInterpolation": "linear",
"lineWidth": 1,
"pointSize": 5,
"scaleDistribution": {
"type": "linear"
},
"showPoints": "auto",
"spanNulls": false,
"stacking": {
"group": "A",
"mode": "none"
},
"thresholdsStyle": {
"mode": "off"
}
},
"mappings": [],
"thresholds": {
"mode": "absolute",
"steps": [
{
"color": "green",
"value": null
},
{
"color": "red",
"value": 80
}
]
},
"unit": "s"
},
"overrides": []
},
"gridPos": {
"h": 10,
"w": 12,
"x": 0,
"y": 9
},
"id": 1,
"options": {
"legend": {
"calcs": [
"lastNotNull",
"max",
"min"
],
"displayMode": "table",
"placement": "bottom",
"showLegend": true
},
"tooltip": {
"mode": "single",
"sort": "none"
}
},
"pluginVersion": "11.3.8+security-01",
"targets": [
{
"datasource": {
"type": "prometheus",
"uid": "P5DCFC7561CCDE821"
},
"editorMode": "code",
"expr": "sum(io_exporter_io_read_latency{container=\"ioexporter\",namespace=\"$namespace\"}) by (pod)",
"legendFormat": "{{pod}}",
"range": true,
"refId": "A"
}
],
"title": "IO Read Latency",
"type": "timeseries"
},
{
"datasource": {
"type": "prometheus",
"uid": "P5DCFC7561CCDE821"
},
"fieldConfig": {
"defaults": {
"color": {
"mode": "palette-classic"
},
"custom": {
"axisBorderShow": false,
"axisCenteredZero": false,
"axisColorMode": "text",
"axisLabel": "",
"axisPlacement": "auto",
"barAlignment": 0,
"barWidthFactor": 0.6,
"drawStyle": "line",
"fillOpacity": 0,
"gradientMode": "none",
"hideFrom": {
"legend": false,
"tooltip": false,
"viz": false
},
"insertNulls": false,
"lineInterpolation": "linear",
"lineWidth": 1,
"pointSize": 5,
"scaleDistribution": {
"type": "linear"
},
"showPoints": "auto",
"spanNulls": false,
"stacking": {
"group": "A",
"mode": "none"
},
"thresholdsStyle": {
"mode": "off"
}
},
"mappings": [],
"thresholds": {
"mode": "absolute",
"steps": [
{
"color": "green",
"value": null
},
{
"color": "red",
"value": 80
}
]
},
"unit": "s"
},
"overrides": []
},
"gridPos": {
"h": 10,
"w": 12,
"x": 12,
"y": 9
},
"id": 3,
"options": {
"legend": {
"calcs": [
"lastNotNull",
"max",
"min"
],
"displayMode": "table",
"placement": "bottom",
"showLegend": true
},
"tooltip": {
"mode": "single",
"sort": "none"
}
},
"pluginVersion": "11.3.8+security-01",
"targets": [
{
"datasource": {
"type": "prometheus",
"uid": "P5DCFC7561CCDE821"
},
"editorMode": "code",
"expr": "sum(io_exporter_io_write_latency{container=\"ioexporter\",namespace=\"$namespace\"}) by (pod)",
"legendFormat": "{{pod}}",
"range": true,
"refId": "A"
}
],
"title": "IO Write Latency",
"type": "timeseries"
},
{
"datasource": {
"type": "prometheus",
"uid": "P5DCFC7561CCDE821"
},
"description": "",
"fieldConfig": {
"defaults": {
"color": {
"mode": "palette-classic-by-name"
},
"custom": {
"axisBorderShow": false,
"axisCenteredZero": false,
"axisColorMode": "text",
"axisLabel": "",
"axisPlacement": "auto",
"barAlignment": 0,
"barWidthFactor": 0.6,
"drawStyle": "line",
"fillOpacity": 55,
"gradientMode": "none",
"hideFrom": {
"legend": false,
"tooltip": false,
"viz": false
},
"insertNulls": false,
"lineInterpolation": "linear",
"lineWidth": 0,
"pointSize": 5,
"scaleDistribution": {
"type": "linear"
},
"showPoints": "never",
"spanNulls": false,
"stacking": {
"group": "A",
"mode": "normal"
},
"thresholdsStyle": {
"mode": "off"
}
},
"mappings": [],
"min": 0,
"thresholds": {
"mode": "absolute",
"steps": [
{
"color": "green",
"value": null
},
{
"color": "red",
"value": 80
}
]
},
"unit": "s"
},
"overrides": [
{
"__systemRef": "hideSeriesFrom",
"matcher": {
"id": "byNames",
"options": {
"mode": "exclude",
"names": [
"Value"
],
"prefix": "All except:",
"readOnly": true
}
},
"properties": [
{
"id": "custom.hideFrom",
"value": {
"legend": false,
"tooltip": false,
"viz": true
}
}
]
}
]
},
"gridPos": {
"h": 9,
"w": 12,
"x": 0,
"y": 19
},
"id": 5,
"interval": "1m",
"options": {
"legend": {
"calcs": [
"lastNotNull",
"mean",
"min",
"max"
],
"displayMode": "table",
"placement": "bottom",
"showLegend": true
},
"tooltip": {
"mode": "single",
"sort": "none"
}
},
"pluginVersion": "11.3.8+security-01",
"targets": [
{
"datasource": {
"uid": "$datasource"
},
"editorMode": "code",
"expr": "sum(node_namespace_pod_container:container_cpu_usage_seconds_total:sum_irate{namespace=\"$namespace\", container=\"ioexporter\"}) by (pod)",
"format": "time_series",
"intervalFactor": 2,
"legendFormat": "{{pod}}",
"range": true,
"refId": "A"
}
],
"title": "CPU Usage IO Exporter",
"type": "timeseries"
},
{
"datasource": {
"type": "prometheus",
"uid": "P5DCFC7561CCDE821"
},
"description": "Memory Usage and Limit in Bytes",
"fieldConfig": {
"defaults": {
"color": {
"mode": "palette-classic"
},
"custom": {
"axisBorderShow": false,
"axisCenteredZero": false,
"axisColorMode": "text",
"axisLabel": "",
"axisPlacement": "auto",
"barAlignment": 0,
"barWidthFactor": 0.6,
"drawStyle": "line",
"fillOpacity": 10,
"gradientMode": "none",
"hideFrom": {
"legend": false,
"tooltip": false,
"viz": false
},
"insertNulls": false,
"lineInterpolation": "linear",
"lineWidth": 1,
"pointSize": 5,
"scaleDistribution": {
"type": "linear"
},
"showPoints": "never",
"spanNulls": false,
"stacking": {
"group": "A",
"mode": "none"
},
"thresholdsStyle": {
"mode": "off"
}
},
"links": [],
"mappings": [],
"thresholds": {
"mode": "absolute",
"steps": [
{
"color": "green",
"value": null
},
{
"color": "red",
"value": 80
}
]
},
"unit": "decbytes"
},
"overrides": []
},
"gridPos": {
"h": 9,
"w": 12,
"x": 12,
"y": 19
},
"id": 6,
"options": {
"alertThreshold": true,
"legend": {
"calcs": [
"mean",
"lastNotNull",
"max",
"min"
],
"displayMode": "table",
"placement": "bottom",
"showLegend": true
},
"tooltip": {
"mode": "multi",
"sort": "none"
}
},
"pluginVersion": "11.3.8+security-01",
"targets": [
{
"datasource": {
"type": "prometheus",
"uid": "P5DCFC7561CCDE821"
},
"editorMode": "code",
"exemplar": true,
"expr": "sum(container_memory_working_set_bytes{namespace=\"$namespace\", container=\"ioexporter\"}) by (pod)",
"format": "time_series",
"interval": "",
"intervalFactor": 2,
"legendFormat": "{{pod}}",
"range": true,
"refId": "A"
}
],
"title": "Average Memory Usage IO Explorer",
"type": "timeseries"
}
],
"preload": false,
"schemaVersion": 40,
"tags": [],
"templating": {
"list": [
{
"current": {
"text": "exporter-test",
"value": "exporter-test"
},
"definition": "label_values(io_exporter_io_operation,namespace)",
"includeAll": true,
"name": "namespace",
"options": [],
"query": {
"qryType": 1,
"query": "label_values(io_exporter_io_operation,namespace)",
"refId": "PrometheusVariableQueryEditor-VariableQuery"
},
"refresh": 1,
"regex": "",
"type": "query"
}
]
},
"time": {
"from": "now-6h",
"to": "now"
},
"timepicker": {},
"timezone": "browser",
"title": "io-test",
"uid": "ef1tcv0azbpc0e",
"version": 11,
"weekStart": ""
}

BIN
grafana/screenshot.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 181 KiB