From 92f0120c47839efeee9aba6595f415c088924761 Mon Sep 17 00:00:00 2001 From: garionion Date: Mon, 14 Jun 2021 16:36:30 +0200 Subject: [PATCH] add postgres monitoring --- hosts/geon/gitea.nix | 7 +++++++ hosts/kaon/auxMonHosts.nix | 14 ++++++++++++++ hosts/kaon/monitoring.nix | 31 ++++++++++++++++++++++++++++--- 3 files changed, 49 insertions(+), 3 deletions(-) create mode 100644 hosts/kaon/auxMonHosts.nix diff --git a/hosts/geon/gitea.nix b/hosts/geon/gitea.nix index 35f9251..4944a92 100644 --- a/hosts/geon/gitea.nix +++ b/hosts/geon/gitea.nix @@ -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 = { diff --git a/hosts/kaon/auxMonHosts.nix b/hosts/kaon/auxMonHosts.nix new file mode 100644 index 0000000..1fe306c --- /dev/null +++ b/hosts/kaon/auxMonHosts.nix @@ -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" + ]; +} diff --git a/hosts/kaon/monitoring.nix b/hosts/kaon/monitoring.nix index 9b1a8a8..b881772 100644 --- a/hosts/kaon/monitoring.nix +++ b/hosts/kaon/monitoring.nix @@ -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";