summaryrefslogtreecommitdiffstats
path: root/lass/2configs/monitoring/prometheus-server.nix
diff options
context:
space:
mode:
authormakefu <github@syntax-fehler.de>2018-05-03 18:45:55 +0200
committermakefu <github@syntax-fehler.de>2018-05-03 18:45:55 +0200
commit8156ab92378422d36d0af55c8d4b3b5742f4305c (patch)
treefcbcb08991681dcd24a88d7a9bac7f22840df575 /lass/2configs/monitoring/prometheus-server.nix
parent45377068c0bfbb009b7cbe41dbca97dd44c9c955 (diff)
parent28d6704a0d617ca7d379b836ab9fdd4d6a0be868 (diff)
Merge remote-tracking branch 'lass/master'
Diffstat (limited to 'lass/2configs/monitoring/prometheus-server.nix')
-rw-r--r--lass/2configs/monitoring/prometheus-server.nix50
1 files changed, 44 insertions, 6 deletions
diff --git a/lass/2configs/monitoring/prometheus-server.nix b/lass/2configs/monitoring/prometheus-server.nix
index d56d7e552..e16d421a0 100644
--- a/lass/2configs/monitoring/prometheus-server.nix
+++ b/lass/2configs/monitoring/prometheus-server.nix
@@ -9,6 +9,12 @@
# useDHCP = true;
#};
+ krebs.iptables.tables.filter.INPUT.rules = [
+ { predicate = "-i retiolum -p tcp --dport 3000"; target = "ACCEPT"; }
+ { predicate = "-i retiolum -p tcp --dport 9090"; target = "ACCEPT"; }
+ { predicate = "-i retiolum -p tcp --dport 9093"; target = "ACCEPT"; }
+ ];
+
services = {
prometheus = {
enable = true;
@@ -124,11 +130,10 @@
static_configs = [
{
targets = [
- "localhost:9100"
- ];
- labels = {
- alias = "prometheus.example.com";
- };
+ ] ++ map (host: "${host}:9100") (lib.attrNames (lib.filterAttrs (_: host: host.owner.name == "lass" && host.monitoring) config.krebs.hosts));
+ #labels = {
+ # alias = "prometheus.example.com";
+ #};
}
];
}
@@ -159,7 +164,7 @@
];
"webhook_configs" = [
{
- "url" = "https://example.com/prometheus-alerts";
+ "url" = "http://127.0.0.1:14813/prometheus-alerts";
"send_resolved" = true;
}
];
@@ -176,4 +181,37 @@
security = import <secrets/grafana_security.nix>; # { AdminUser = ""; adminPassword = ""}
};
};
+ services.logstash = {
+ enable = true;
+ inputConfig = ''
+ http {
+ port => 14813
+ host => "127.0.0.1"
+ }
+ '';
+ filterConfig = ''
+ if ([alerts]) {
+ ruby {
+ code => '
+ lines = []
+ event["alerts"].each {|p|
+ lines << "#{p["labels"]["instance"]}#{p["annotations"]["summary"]} #{p["status"]}"
+ }
+ event["output"] = lines.join("\n")
+ '
+ }
+ }
+ '';
+ outputConfig = ''
+ file { path => "/tmp/logs.json" codec => "json_lines" }
+ irc {
+ channels => [ "#noise" ]
+ host => "irc.r"
+ nick => "alarm"
+ codec => "json_lines"
+ format => "%{output}"
+ }
+ '';
+ #plugins = [ ];
+ };
}