Skip to content

Commit

Permalink
feat: add ttl info panels
Browse files Browse the repository at this point in the history
Change-Id: Ie384c2aa3b360800da564a0206f8308a2bbbdd24
Reviewed-on: https://review.monogon.dev/c/NetMeta/+/1942
Reviewed-by: Leopold Schabel <[email protected]>
  • Loading branch information
fionera committed Jul 18, 2023
1 parent bf930a0 commit 7297afa
Show file tree
Hide file tree
Showing 2 changed files with 38 additions and 4 deletions.
40 changes: 37 additions & 3 deletions deploy/dashboards/base.cue
Original file line number Diff line number Diff line change
Expand Up @@ -66,6 +66,18 @@ _infoPanelQueries: {
#"""
select (toUnixTimestamp(now()) - TimeReceived) from flows_raw ORDER BY TimeReceived limit 1
"""#
"TTL Active":
#"""
SELECT if(min(delete_ttl_info_min) == 0, 'No', 'Yes')
FROM system.parts
WHERE (database = 'default') AND (table = 'flows_raw')
"""#
"TTL next deletion":
#"""
SELECT min(delete_ttl_info_min)
FROM system.parts
WHERE (database = 'default') AND (table = 'flows_raw')
"""#
}

_infoPanels: [{
Expand Down Expand Up @@ -109,6 +121,28 @@ _infoPanels: [{
targets: [{
rawSql: _infoPanelQueries[title]
}]
}, {
title: "TTL Active"
type: "stat"
gridPos: {h: 3, w: 5, x: 10, y: 0}
fieldConfig: defaults: unit: "short"
fieldConfig: defaults: color: fixedColor: "purple"
fieldConfig: defaults: color: mode: "fixed"
options: reduceOptions: fields: "/.*/"
targets: [{
rawSql: _infoPanelQueries[title]
}]
}, {
title: "TTL next deletion"
type: "stat"
gridPos: {h: 3, w: 5, x: 10, y: 3}
fieldConfig: defaults: unit: "short"
fieldConfig: defaults: color: fixedColor: "purple"
fieldConfig: defaults: color: mode: "fixed"
options: reduceOptions: fields: "/.*/"
targets: [{
rawSql: _infoPanelQueries[title]
}]
}]

_negativeYOut: {
Expand Down Expand Up @@ -140,7 +174,7 @@ _textBoxes: {
dashboards: [string]: D={
_panels: [...#Panel]
panels: [ for i, v in D._panels {
id: i
id: i
interval: #Config.minInterval
for _, t in #PanelStructs if t.type == v.type {
(t & v)
Expand Down Expand Up @@ -170,8 +204,8 @@ dashboards: [string]: templating: _list: [{
current: {
selected: false
// we wrap the variable into a string to enforce previous declared defaults to be evaluated
text: "\(#Config.fastNetMon.dataSource)"
value: "\(#Config.fastNetMon.dataSource)"
text: "\(#Config.fastNetMon.dataSource)"
value: "\(#Config.fastNetMon.dataSource)"
}
label: "Datasource"
name: "datasource_fnm"
Expand Down
2 changes: 1 addition & 1 deletion deploy/dashboards/types.cue
Original file line number Diff line number Diff line change
Expand Up @@ -207,7 +207,7 @@ import "strings"
calcs: [
"lastNotNull",
]
fields: ""
fields: *"" | string
values: false
}
textMode: "auto"
Expand Down

0 comments on commit 7297afa

Please sign in to comment.