From f39df4913b225ec67ca0557e3b702323bcb2bf2b Mon Sep 17 00:00:00 2001 From: lassulus Date: Tue, 7 Feb 2017 17:10:34 +0100 Subject: l 2 monitoring server: use new kapacitor config --- lass/2configs/monitoring/server.nix | 66 ++++++++++++++++++++----------------- 1 file changed, 36 insertions(+), 30 deletions(-) (limited to 'lass') 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 ; 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 ; ''; 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}') + ''; + }; }; }; -- cgit v1.2.3