add postgres monitoring

This commit is contained in:
garionion 2021-06-14 16:36:30 +02:00
parent c2b164bddd
commit 92f0120c47
Signed by: garionion
GPG key ID: 53352FA607FA681A
3 changed files with 49 additions and 3 deletions

View file

@ -72,6 +72,13 @@
}
];
};
services.prometheus.exporters.postgres = {
enable = true;
port = 9101;
runAsLocalSuperUser = true;
openFirewall = true;
firewallFilter = "-i wg-monitoring -p tcp -m tcp --dport 9101";
};
networking.firewall.allowedTCPPorts = [ 80 443 ];
services.nginx = {

View file

@ -0,0 +1,14 @@
{ }:
rec {
postgresExporter = [
"kaon.mon.entr0py.de:9101"
"luxon.mon.entr0py.de:9101"
"geon.mon.entr0py.de:9101"
];
synapseExporter = [
"luxon.mon.entr0py.de:9123"
];
}

View file

@ -23,10 +23,12 @@ let
"${host.config.networking.hostName}.mon.entr0py.de:9100")
monitoringHosts;
auxHosts = (import ./auxMonHosts.nix {});
in {
networking.hosts = {
"fd00:23:23:23::1" = [ "monitoring-1.mon.entr0py.de" ];
"fd00:23:23:23::1" = [ "kaon.mon.entr0py.de" ];
}
// monitoringHostsNames;
@ -62,16 +64,33 @@ in {
}
{
job_name = "node-exporter";
scrape_interval = "60s";
scrape_interval = "20s";
static_configs = [
{
targets = [
"monitoring-1.mon.entr0py.de:9100"
"kaon.mon.entr0py.de:9100"
]
++ monitoringTargets;
}
];
}
{
job_name = "postgres";
scrape_interval = "5s";
static_configs = [
{
targets = auxHosts.postgresExporter;
}
];
}
{
job_name = "synapse";
scrape_interval = "5s";
metrics_path = "/_synapse/metrics";
static_configs = [{
targets = auxHosts.synapseExporter;
}];
}
];
};
@ -86,6 +105,12 @@ in {
}
];
};
services.prometheus.exporters.postgres = {
enable = true;
runAsLocalSuperUser = true;
port = 9101;
};
services.grafana = {
enable = true;
domain = "grafana.monitoring.entr0py.de";