bundles/zfs: report *used*, not free storage space

This commit is contained in:
Franzi 2021-06-29 15:18:31 +02:00
parent 73ebf746f9
commit 7f27762054
Signed by: kunsi
GPG key ID: 12E3D2136B818350
2 changed files with 8 additions and 8 deletions

View file

@ -541,7 +541,7 @@ def dashboard_row_zfs(panel_id, node):
r["host"] == "{node.name}"
)
|> aggregateWindow(every: v.windowPeriod, fn: mean, createEmpty: false)
|> yield(name: "out")""",
|> yield(name: "usedsnap")""",
'resultFormat': 'time_series',
'select': [[
{'type': 'field', 'params': ['value']},
@ -644,11 +644,11 @@ def dashboard_row_zfs(panel_id, node):
|> range(start: v.timeRangeStart, stop: v.timeRangeStop)
|> filter(fn: (r) =>
r["_measurement"] == "zfs_pool" and
r["_field"] == "free" and
r["_field"] == "used" and
r["host"] == "{node.name}"
)
|> aggregateWindow(every: v.windowPeriod, fn: mean, createEmpty: false)
|> yield(name: "in")""",
|> yield(name: "used")""",
'resultFormat': 'time_series',
'select': [[
{'type': 'field', 'params': ['value']},
@ -671,7 +671,7 @@ def dashboard_row_zfs(panel_id, node):
r["host"] == "{node.name}"
)
|> aggregateWindow(every: v.windowPeriod, fn: mean, createEmpty: false)
|> yield(name: "out")""",
|> yield(name: "size")""",
'resultFormat': 'time_series',
'select': [[
{'type': 'field', 'params': ['value']},

View file

@ -3,7 +3,7 @@
from subprocess import check_output
pools = check_output(
['/usr/sbin/zpool', 'list', '-Hpo', 'name,free,size'],
['/usr/sbin/zpool', 'list', '-Hpo', 'name,allocated,size'],
env={
'LC_ALL': 'C',
},
@ -18,14 +18,14 @@ datasets = check_output(
zpools = {}
for line in pools.splitlines():
name, free, total = line.split()
name, used, total = line.split()
zpools[name] = {
'free': free,
'used': used,
'total': total,
}
print('zfs_pool,pool={} size={}i,free={}i'.format(name, total, free))
print('zfs_pool,pool={} size={}i,used={}i'.format(name, total, used))
for line in datasets.splitlines():
name, used, usedsnap, compressratio = line.split()