mirror of
https://git.sr.ht/~magic_rb/dotfiles
synced 2024-11-30 03:56:12 +01:00
30 lines
892 B
Plaintext
30 lines
892 B
Plaintext
|
arcsize =
|
||
|
from(bucket: "metrics")
|
||
|
|> range(start: -duration(v: task.every))
|
||
|
|> filter(fn: (r) => r._measurement == "zfs" and r._field == "arcstats_size")
|
||
|
|> mean()
|
||
|
|
||
|
used =
|
||
|
from(bucket: "metrics")
|
||
|
|> range(start: -duration(v: task.every))
|
||
|
|> filter(fn: (r) => r._measurement == "mem" and r._field == "used")
|
||
|
|> mean()
|
||
|
|
||
|
free =
|
||
|
from(bucket: "metrics")
|
||
|
|> range(start: -duration(v: task.every))
|
||
|
|> filter(fn: (r) => r._measurement == "mem" and r._field == "available")
|
||
|
|> mean()
|
||
|
|
||
|
union(tables: [arcsize, used, free])
|
||
|
|> group()
|
||
|
|> map(
|
||
|
fn: (r) =>
|
||
|
({r with used: r.used - r.arcstats_size,
|
||
|
available: r.available + r.arcstats_size,
|
||
|
_time: r._start,
|
||
|
}),
|
||
|
)
|
||
|
|> group(columns: ["_time", "host"])
|
||
|
|> to(bucket: "metrics-preprocessed")
|