Skip to content

Commit

Permalink
feat: added Alert query for bucket cardinality
Browse files Browse the repository at this point in the history
Signed-off-by: Arnav Aggarwal <[email protected]>
  • Loading branch information
Nav-aggarwal09 committed Feb 1, 2021
1 parent 9a33b39 commit 88b6477
Showing 1 changed file with 31 additions and 11 deletions.
42 changes: 31 additions & 11 deletions influxdb2_operational_monitoring/influxdb2_cardinality_now.yml
Original file line number Diff line number Diff line change
@@ -1,19 +1,39 @@
apiVersion: influxdata.com/v2alpha1
kind: Label
metadata:
name: kind-spence-53b001
name: admiring-ardinghelli-4ae001
spec:
color: '#fafafc'
name: cardinality
---
apiVersion: influxdata.com/v2alpha1
kind: Task
metadata:
name: ridiculous-elion-cae001
spec:
associations:
- kind: Label
name: admiring-ardinghelli-4ae001
every: 1d
name: 'Cardinality Alert '
offset: 20m0s
query: "import \"influxdata/influxdb\"\nimport \"slack\"\n\n\nalert = (givenCard)
=> if givenCard >= 1 then \n() => slack.message(\nurl: \"https://hooks.slack.com/services/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\",\nchannel:
\"#team-compute\",\ntext: \"TEST: Cardinality at \\\"${string(v: givenCard)}\\\"!\",\ncolor:
\"danger\",\n)\nelse \n() => 0\n\nbuckets()\n |> map(fn: (r) => {\ncards
= influxdb.cardinality(start: -1d, bucket: r.name)\n |> findRecord(idx:
0, fn: (key) => (true))\nresult = alert(givenCard:cards._value)\n return{\nr
with card:cards._value,\nsent: result()\n}\n})"
status: active
---
apiVersion: influxdata.com/v2alpha1
kind: Variable
metadata:
name: amazing-boyd-93b003
name: infallible-hellman-cae005
spec:
associations:
- kind: Label
name: kind-spence-53b001
name: admiring-ardinghelli-4ae001
language: flux
name: bucket
query: |-
Expand All @@ -26,11 +46,11 @@ spec:
apiVersion: influxdata.com/v2alpha1
kind: Variable
metadata:
name: blissful-morse-53b003
name: victorious-hertz-cae009
spec:
associations:
- kind: Label
name: kind-spence-53b001
name: admiring-ardinghelli-4ae001
language: flux
name: measurement
query: |-
Expand All @@ -42,11 +62,11 @@ spec:
apiVersion: influxdata.com/v2alpha1
kind: Dashboard
metadata:
name: nostalgic-einstein-13b001
name: terrifying-dubinsky-4ae001
spec:
associations:
- kind: Label
name: kind-spence-53b001
name: admiring-ardinghelli-4ae001
charts:
- axes:
- base: "10"
Expand All @@ -69,7 +89,7 @@ spec:
name: Nineteen Eighty Four
type: scale
geom: line
height: 3
height: 4
hoverDimension: auto
kind: Xy
legendOpacity: 1
Expand Down Expand Up @@ -155,7 +175,7 @@ spec:
verticalTimeAxis: true
timeFormat: YYYY-MM-DD HH:mm:ss
width: 12
yPos: 3
yPos: 4
- colors:
- hex: '#ffffff'
id: base
Expand Down Expand Up @@ -194,7 +214,7 @@ spec:
verticalTimeAxis: true
timeFormat: YYYY-MM-DD HH:mm:ss
width: 12
yPos: 7
yPos: 8
- colors:
- hex: '#ffffff'
id: base
Expand Down Expand Up @@ -234,5 +254,5 @@ spec:
verticalTimeAxis: true
timeFormat: YYYY-MM-DD HH:mm:ss
width: 12
yPos: 10
yPos: 11
name: Cardinality Now

0 comments on commit 88b6477

Please sign in to comment.