l 2 monitoring server: use new kapacitor config
This commit is contained in:
parent
2b68541e29
commit
f39df4913b
|
@ -22,6 +22,7 @@ with import <stockholm/lib>;
|
||||||
|
|
||||||
lass.kapacitor =
|
lass.kapacitor =
|
||||||
let
|
let
|
||||||
|
db = "telegraf_db";
|
||||||
echoToIrc = pkgs.writeDash "echo_irc" ''
|
echoToIrc = pkgs.writeDash "echo_irc" ''
|
||||||
set -euf
|
set -euf
|
||||||
data="$(${pkgs.jq}/bin/jq -r .message)"
|
data="$(${pkgs.jq}/bin/jq -r .message)"
|
||||||
|
@ -31,37 +32,42 @@ with import <stockholm/lib>;
|
||||||
'';
|
'';
|
||||||
in {
|
in {
|
||||||
enable = true;
|
enable = true;
|
||||||
check_db = "telegraf_db";
|
|
||||||
alarms = {
|
alarms = {
|
||||||
cpu = ''
|
cpu = {
|
||||||
var data = batch
|
database = db;
|
||||||
|query(${"'''"}
|
text = ''
|
||||||
SELECT mean("usage_user") AS mean
|
var data = batch
|
||||||
FROM "${config.lass.kapacitor.check_db}"."default"."cpu"
|
|query(${"'''"}
|
||||||
${"'''"})
|
SELECT mean("usage_user") AS mean
|
||||||
.period(10m)
|
FROM "${db}"."default"."cpu"
|
||||||
.every(1m)
|
${"'''"})
|
||||||
.groupBy('host')
|
.period(10m)
|
||||||
data |alert()
|
.every(1m)
|
||||||
.crit(lambda: "mean" > 90)
|
.groupBy('host')
|
||||||
.exec('${echoToIrc}')
|
data |alert()
|
||||||
data |deadman(1.0,5m)
|
.crit(lambda: "mean" > 90)
|
||||||
.stateChangesOnly()
|
.exec('${echoToIrc}')
|
||||||
.exec('${echoToIrc}')
|
data |deadman(1.0,5m)
|
||||||
'';
|
.stateChangesOnly()
|
||||||
ram = ''
|
.exec('${echoToIrc}')
|
||||||
var data = batch
|
'';
|
||||||
|query(${"'''"}
|
};
|
||||||
SELECT mean("used_percent") AS mean
|
ram = {
|
||||||
FROM "${config.lass.kapacitor.check_db}"."default"."mem"
|
database = db;
|
||||||
${"'''"})
|
text = ''
|
||||||
.period(10m)
|
var data = batch
|
||||||
.every(1m)
|
|query(${"'''"}
|
||||||
.groupBy('host')
|
SELECT mean("used_percent") AS mean
|
||||||
data |alert()
|
FROM "${db}"."default"."mem"
|
||||||
.crit(lambda: "mean" > 90)
|
${"'''"})
|
||||||
.exec('${echoToIrc}')
|
.period(10m)
|
||||||
'';
|
.every(1m)
|
||||||
|
.groupBy('host')
|
||||||
|
data |alert()
|
||||||
|
.crit(lambda: "mean" > 90)
|
||||||
|
.exec('${echoToIrc}')
|
||||||
|
'';
|
||||||
|
};
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue