From 010f3ece9099dac7f5b34e42e515b6707be1ce1e Mon Sep 17 00:00:00 2001 From: Ryan Yin Date: Sun, 18 Feb 2024 20:44:24 +0800 Subject: [PATCH] feat: prometheus targets --- Justfile | 11 ++++------ hosts/idols_aquamarine/router.nix | 1 + hosts/idols_ruby/prometheus/default.nix | 29 +++++++++++++++++++++++++ 3 files changed, 34 insertions(+), 7 deletions(-) diff --git a/Justfile b/Justfile index b13c8fee..fe45c5e5 100644 --- a/Justfile +++ b/Justfile @@ -93,24 +93,21 @@ colmena-ssh-key: ssh-add /etc/agenix/ssh-key-romantic lab: - colmena apply --on '@homelab' - -lab-debug: colmena apply --on '@homelab' --verbose --show-trace aqua: - colmena apply --on '@aqua' + colmena apply --on '@aqua' --verbose --show-trace # some config changes require a restart of the dae service ssh ryan@aquamarine "sudo systemctl stop dae; sleep 1; sudo systemctl start dae" ruby: - colmena apply --on '@ruby' + colmena apply --on '@ruby' --verbose --show-trace kana: - colmena apply --on '@kana' + colmena apply --on '@kana' --verbose --show-trace tsgw: - colmena apply --on '@tailscale_gw' + colmena apply --on '@tailscale-gw' --verbose --show-trace pve-aqua: nom build .#aquamarine diff --git a/hosts/idols_aquamarine/router.nix b/hosts/idols_aquamarine/router.nix index bc2e3066..1325d552 100644 --- a/hosts/idols_aquamarine/router.nix +++ b/hosts/idols_aquamarine/router.nix @@ -172,6 +172,7 @@ in { listenAddress = "0.0.0.0"; port = 9153; openFirewall = false; + leasesPath = "/var/lib/dnsmasq/dnsmasq.leases"; }; # The service irqbalance is useful as it assigns certain IRQ calls to specific CPUs instead of diff --git a/hosts/idols_ruby/prometheus/default.nix b/hosts/idols_ruby/prometheus/default.nix index 798a4987..0046ac7c 100644 --- a/hosts/idols_ruby/prometheus/default.nix +++ b/hosts/idols_ruby/prometheus/default.nix @@ -46,6 +46,7 @@ # specifies a set of targets and parameters describing how to scrape metrics from them. # https://prometheus.io/docs/prometheus/latest/configuration/configuration/#scrape_config scrapeConfigs = [ + # --- Hosts --- # { job_name = "node-exporter"; scrape_interval = "30s"; @@ -60,6 +61,34 @@ } ]; } + + # --- Homelab Applications --- # + + { + job_name = "dnsmasq-exporter"; + scrape_interval = "30s"; + metrics_path = "/metrics"; + static_configs = [ + { + targets = ["${vars_networking.hostAddress.aquamarine.address}:9153"]; + labels.type = "app"; + labels.app = "dnsmasq"; + } + ]; + } + + { + job_name = "v2ray-exporter"; + scrape_interval = "30s"; + metrics_path = "/metrics"; + static_configs = [ + { + targets = ["${vars_networking.hostAddress.kana.address}:9153"]; + labels.type = "app"; + labels.app = "v2ray"; + } + ]; + } ]; # specifies Alertmanager instances the Prometheus server sends alerts to