summaryrefslogtreecommitdiffstats
path: root/modules/tozt/files
diff options
context:
space:
mode:
authorJesse Luehrs <doy@tozt.net>2020-07-05 03:49:01 -0400
committerJesse Luehrs <doy@tozt.net>2020-07-05 04:04:02 -0400
commitf5d1b69f90a73b1c88c8fd9b33ce3a92fcb6611b (patch)
treea40482d1094fe2eafc082de642d84101cd3b01db /modules/tozt/files
parentb133adefd285ff93f24b30d27bab4714ef1fc67b (diff)
downloadpuppet-tozt-f5d1b69f90a73b1c88c8fd9b33ce3a92fcb6611b.tar.gz
puppet-tozt-f5d1b69f90a73b1c88c8fd9b33ce3a92fcb6611b.zip
add an alert for no metrics
Diffstat (limited to 'modules/tozt/files')
-rw-r--r--modules/tozt/files/kapacitor/deadman.tick26
1 files changed, 26 insertions, 0 deletions
diff --git a/modules/tozt/files/kapacitor/deadman.tick b/modules/tozt/files/kapacitor/deadman.tick
new file mode 100644
index 0000000..44eec0c
--- /dev/null
+++ b/modules/tozt/files/kapacitor/deadman.tick
@@ -0,0 +1,26 @@
+dbrp "telegraf"."autogen"
+
+var message = '''
+{{- if eq .Level "OK" -}}
+{{ index .Tags "host" }} is reporting metrics again
+{{- else -}}
+{{ index .Tags "host" }} is not reporting metrics
+{{- end -}}
+'''
+
+var details = '''
+{{- if eq .Level "OK" -}}
+{{ index .Tags "host" }} resumed reporting metrics at {{ .Time }}
+{{- else -}}
+{{ index .Tags "host" }} stopped reporting metrics at {{ .Time }}
+{{- end -}}
+'''
+
+stream
+|from()
+ .measurement('cpu')
+ .groupBy('host')
+ .where(lambda: "host" != 'hush')
+|deadman(0.0, 10m)
+ .message(message)
+ .details(details)