diff --git a/bundles/zfs/metadata.py b/bundles/zfs/metadata.py index 6ca2454..92837a6 100644 --- a/bundles/zfs/metadata.py +++ b/bundles/zfs/metadata.py @@ -75,6 +75,9 @@ defaults = { }, }, }, + 'grafana_rows': { + 'zfs_arc', + }, 'zfs': { 'datasets': {}, 'pools': {}, diff --git a/data/grafana/flux.mako b/data/grafana/flux.mako index 48dc8ee..42de3f6 100644 --- a/data/grafana/flux.mako +++ b/data/grafana/flux.mako @@ -7,8 +7,8 @@ from(bucket: "${bucket}") % if function == 'derivative': |> derivative(nonNegative: true) % endif + |> aggregateWindow(every: duration(v: int(v: v.windowPeriod)*${resolution}), fn: mean, createEmpty: false) % if negative: |> map(fn: (r) => ({r with _value: r._value * - 1.0})) % endif - |> aggregateWindow(every: duration(v: int(v: v.windowPeriod)*${resolution}), fn: mean, createEmpty: false) |> yield(name: "mean") diff --git a/data/grafana/rows/zfs_arc.py b/data/grafana/rows/zfs_arc.py new file mode 100644 index 0000000..5dc684e --- /dev/null +++ b/data/grafana/rows/zfs_arc.py @@ -0,0 +1,62 @@ +{ + 'l2_size': { + 'queries': { + 'l2_size': { + 'filters': { + '_measurement': 'zfs', + '_field': [ + 'arcstats_l2_size', + ], + }, + 'function': 'mean', + }, + }, + 'unit': 'bytes', + }, + 'l2_io': { + 'queries': { + 'read': { + 'filters': { + '_measurement': 'zfs', + '_field': [ + 'arcstats_l2_read_bytes', + ], + }, + 'function': 'derivative', + }, + 'write': { + 'filters': { + '_measurement': 'zfs', + '_field': [ + 'arcstats_l2_write_bytes', + ], + }, + 'function': 'derivative', + 'negative': True, + }, + }, + }, + 'l2_cache_hits': { + 'queries': { + 'hits': { + 'filters': { + '_measurement': 'zfs', + '_field': [ + 'arcstats_l2_hits', + ], + }, + 'function': 'derivative', + }, + 'misses': { + 'filters': { + '_measurement': 'zfs', + '_field': [ + 'arcstats_l2_misses', + ], + }, + 'function': 'derivative', + 'negative': True, + }, + }, + }, +}