aboutsummaryrefslogtreecommitdiff
path: root/modules/monitoring/default.nix
diff options
context:
space:
mode:
Diffstat (limited to '')
-rw-r--r--modules/monitoring/default.nix70
1 files changed, 17 insertions, 53 deletions
diff --git a/modules/monitoring/default.nix b/modules/monitoring/default.nix
index 05ca338..afcffa5 100644
--- a/modules/monitoring/default.nix
+++ b/modules/monitoring/default.nix
@@ -1,7 +1,9 @@
{ self, config, lib, pkgs, ... }:
with self.lib.nginx;
-{
+with self.lib.mon;
+let exp = config.services.prometheus.exporters;
+in {
services.prometheus = {
enable = true;
enableReload = true;
@@ -10,70 +12,32 @@ with self.lib.nginx;
listenAddress = "10.10.0.1";
webExternalUrl = "https://prometheus.vapor.systems";
- exporters = {
- postgres = {
- enable = true;
- };
- };
-
globalConfig = {
scrape_interval = "10s";
};
scrapeConfigs = [
- {
- job_name = "node";
- static_configs = [
- { targets = [ "ettves:${toString config.services.prometheus.exporters.node.port}" ]; }
- { targets = [ "phaenn:${toString config.services.prometheus.exporters.node.port}" ]; }
- ];
- }
- {
- job_name = "zfs";
- static_configs = [
- { targets = [ "ettves:${toString config.services.prometheus.exporters.zfs.port}" ]; }
- { targets = [ "phaenn:${toString config.services.prometheus.exporters.zfs.port}" ]; }
- ];
- }
- {
- job_name = "smartctl";
- static_configs = [
- { targets = [ "ettves:${toString config.services.prometheus.exporters.smartctl.port}" ]; }
- { targets = [ "phaenn:${toString config.services.prometheus.exporters.smartctl.port}" ]; }
- ];
- }
- {
- job_name = "postgres";
- static_configs = [
- { targets = [ "ettves:${toString config.services.prometheus.exporters.postgres.port}" ]; }
- ];
- }
- {
- job_name = "nginx";
- static_configs = [
- { targets = [ "ettves:${toString config.services.prometheus.exporters.nginx.port}" ]; }
- { targets = [ "phaenn:${toString config.services.prometheus.exporters.nginx.port}" ]; }
- ];
- }
- {
- job_name = "quassel";
- static_configs = [
- { targets = [ "localhost:${toString config.services.quassel.settings.metrics.port}" ]; }
- ];
- }
+ (mkScrapeConfig "node" [ "ettves" "phaenn" "fra01" "nyc01" "sin01" ] exp.node.port)
+ (mkScrapeConfig "zfs" [ "ettves" "phaenn" ] exp.zfs.port)
+ (mkScrapeConfig "smartctl" [ "ettves" "phaenn" ] exp.smartctl.port)
+ (mkScrapeConfig "nginx" [ "ettves" "phaenn" "fra01" "nyc01" "sin01" ] exp.nginx.port)
+
+ (mkScrapeConfig "postgres" [ "ettves" ] exp.postgres.port)
+ (mkScrapeConfig "quassel" [ "localhost" ] config.services.quassel.settings.metrics.port)
+
{
job_name = "authentik";
static_configs = [
- { targets = [ "ettves:9300" ]; }
- { targets = [ "ettves:9303" ]; }
- { targets = [ "ettves:9304" ]; }
+ { targets = [ "ettves:9300" "ettves:9303" "ettves:9304" ]; }
];
+ relabel_configs = relabelConfig;
}
+
+ (mkScrapeConfig "garage" [ "fra01" "nyc01" "sin01" ] 3903)
+ (mkScrapeConfig "pdns" [ "ettves" "fra01" "nyc01" "sin01" ] 8081)
];
};
- services.nginx.statusPage = true;
-
services.udev.extraRules = ''
SUBSYSTEM=="nvme", KERNEL=="nvme[0-9]*", GROUP="disk"
'';
@@ -87,7 +51,7 @@ with self.lib.nginx;
services.nginx = {
enable = true;
virtualHosts = {
- "prometheus.vapor.systems" = (proxyDomain "vapor.systems" "http://10.10.0.1:9090/");
+ "prometheus.vapor.systems" = (proxyDomainAuth "vapor.systems" "http://10.10.0.1:9090/");
};
};
}