summaryrefslogtreecommitdiffstats
path: root/lass/2configs/monitoring/server.nix
diff options
context:
space:
mode:
authorlassulus <lass@lassul.us>2017-02-07 17:10:34 +0100
committerlassulus <lass@lassul.us>2017-02-09 10:06:19 +0100
commitf39df4913b225ec67ca0557e3b702323bcb2bf2b (patch)
tree9d780a8284fce64193073c1e05a95f1e6e39b9fd /lass/2configs/monitoring/server.nix
parent2b68541e297fd6fcb67a117c7d816dbcca9e8c64 (diff)
l 2 monitoring server: use new kapacitor config
Diffstat (limited to 'lass/2configs/monitoring/server.nix')
-rw-r--r--lass/2configs/monitoring/server.nix66
1 files changed, 36 insertions, 30 deletions
diff --git a/lass/2configs/monitoring/server.nix b/lass/2configs/monitoring/server.nix
index 505cb7a17..1b556c56b 100644
--- a/lass/2configs/monitoring/server.nix
+++ b/lass/2configs/monitoring/server.nix
@@ -22,6 +22,7 @@ with import <stockholm/lib>;
lass.kapacitor =
let
+ db = "telegraf_db";
echoToIrc = pkgs.writeDash "echo_irc" ''
set -euf
data="$(${pkgs.jq}/bin/jq -r .message)"
@@ -31,37 +32,42 @@ with import <stockholm/lib>;
'';
in {
enable = true;
- check_db = "telegraf_db";
alarms = {
- cpu = ''
- var data = batch
- |query(${"'''"}
- SELECT mean("usage_user") AS mean
- FROM "${config.lass.kapacitor.check_db}"."default"."cpu"
- ${"'''"})
- .period(10m)
- .every(1m)
- .groupBy('host')
- data |alert()
- .crit(lambda: "mean" > 90)
- .exec('${echoToIrc}')
- data |deadman(1.0,5m)
- .stateChangesOnly()
- .exec('${echoToIrc}')
- '';
- ram = ''
- var data = batch
- |query(${"'''"}
- SELECT mean("used_percent") AS mean
- FROM "${config.lass.kapacitor.check_db}"."default"."mem"
- ${"'''"})
- .period(10m)
- .every(1m)
- .groupBy('host')
- data |alert()
- .crit(lambda: "mean" > 90)
- .exec('${echoToIrc}')
- '';
+ cpu = {
+ database = db;
+ text = ''
+ var data = batch
+ |query(${"'''"}
+ SELECT mean("usage_user") AS mean
+ FROM "${db}"."default"."cpu"
+ ${"'''"})
+ .period(10m)
+ .every(1m)
+ .groupBy('host')
+ data |alert()
+ .crit(lambda: "mean" > 90)
+ .exec('${echoToIrc}')
+ data |deadman(1.0,5m)
+ .stateChangesOnly()
+ .exec('${echoToIrc}')
+ '';
+ };
+ ram = {
+ database = db;
+ text = ''
+ var data = batch
+ |query(${"'''"}
+ SELECT mean("used_percent") AS mean
+ FROM "${db}"."default"."mem"
+ ${"'''"})
+ .period(10m)
+ .every(1m)
+ .groupBy('host')
+ data |alert()
+ .crit(lambda: "mean" > 90)
+ .exec('${echoToIrc}')
+ '';
+ };
};
};