mirror of
https://github.com/ryan4yin/nix-config.git
synced 2026-11-13 12:13:46 +01:00
fix(hosts): move UPS/nut metrics to youko after the swap
This commit is contained in:
1 parent
2be0337979
commit
2e5f539a47
4 files changed
+24
-22
No files matched your search
@@ -100,10 +100,12 @@ in
|
||||
params.ups = [ "homelab" ];
|
||||
static_configs = [
|
||||
{
|
||||
targets = [ "${myvars.networking.hostsAddr.shushou.ipv4}:9199" ];
|
||||
# same-host nut exporter bound to loopback (127.0.0.1:9199); the
|
||||
# UPS moved to this host with the SSD swap
|
||||
targets = [ "127.0.0.1:9199" ];
|
||||
labels.type = "app";
|
||||
labels.app = "nut";
|
||||
labels.host = "shushou";
|
||||
labels.host = "youko";
|
||||
labels.env = "homelab";
|
||||
labels.cluster = "homelab";
|
||||
}
|
||||
|
||||
@@ -1,13 +1,12 @@
|
||||
{ myvars, ... }:
|
||||
let
|
||||
hostAddress = myvars.networking.hostsAddr.shushou.ipv4;
|
||||
in
|
||||
{ ... }:
|
||||
{
|
||||
# The UPS (Cypress USB-to-serial, 0665:5161) is attached to this host, which is
|
||||
# now the homelab core. Metrics only for now; coordinated shutdown of all
|
||||
# homelab hosts is a separate feature.
|
||||
power.ups = {
|
||||
enable = true;
|
||||
mode = "standalone";
|
||||
|
||||
# Metrics only. Coordinated shutdown of all homelab hosts is a separate feature.
|
||||
upsmon = {
|
||||
enable = false;
|
||||
settings.POWERDOWNFLAG = null;
|
||||
@@ -33,7 +32,7 @@ in
|
||||
|
||||
services.prometheus.exporters.nut = {
|
||||
enable = true;
|
||||
listenAddress = hostAddress;
|
||||
listenAddress = "127.0.0.1";
|
||||
port = 9199;
|
||||
nutServer = "127.0.0.1";
|
||||
|
||||
@@ -18,7 +18,7 @@
|
||||
|
||||
exporter = {
|
||||
enable = true;
|
||||
listenAddress = "192.168.5.182";
|
||||
listenAddress = "127.0.0.1";
|
||||
port = 9199;
|
||||
nutServer = "127.0.0.1";
|
||||
exportsAllNumericVariables = true;
|
||||
@@ -32,11 +32,11 @@
|
||||
scrape_interval = "30s";
|
||||
metrics_path = "/ups_metrics";
|
||||
params.ups = [ "homelab" ];
|
||||
target = "192.168.5.182:9199";
|
||||
target = "127.0.0.1:9199";
|
||||
labels = {
|
||||
type = "app";
|
||||
app = "nut";
|
||||
host = "shushou";
|
||||
host = "youko";
|
||||
env = "homelab";
|
||||
cluster = "homelab";
|
||||
};
|
||||
|
||||
@@ -4,27 +4,28 @@
|
||||
...
|
||||
}:
|
||||
let
|
||||
shushou = outputs.nixosConfigurations.shushou.config;
|
||||
aquamarine = outputs.nixosConfigurations.youko.config;
|
||||
ups = shushou.power.ups.ups.homelab or { };
|
||||
exporter = shushou.services.prometheus.exporters.nut;
|
||||
# The UPS moved to youko with the SSD swap; the NUT daemons, the exporter, and
|
||||
# the victoriametrics scrape job now all live on the same host.
|
||||
youko = outputs.nixosConfigurations.youko.config;
|
||||
ups = youko.power.ups.ups.homelab or { };
|
||||
exporter = youko.services.prometheus.exporters.nut;
|
||||
exporterService =
|
||||
shushou.systemd.services.prometheus-nut-exporter or {
|
||||
youko.systemd.services.prometheus-nut-exporter or {
|
||||
after = [ ];
|
||||
requires = [ ];
|
||||
};
|
||||
scrapeJobs = builtins.filter (
|
||||
job: (job.job_name or "") == "nut-exporter-homelab-ups"
|
||||
) aquamarine.services.victoriametrics.prometheusConfig.scrape_configs;
|
||||
) youko.services.victoriametrics.prometheusConfig.scrape_configs;
|
||||
scrapeJob = if builtins.length scrapeJobs == 1 then builtins.head scrapeJobs else null;
|
||||
in
|
||||
{
|
||||
nut = {
|
||||
enable = shushou.power.ups.enable;
|
||||
mode = shushou.power.ups.mode;
|
||||
upsmonEnable = shushou.power.ups.upsmon.enable;
|
||||
killPowerEnable = shushou.systemd.services.ups-killpower.enable or false;
|
||||
upsdListen = shushou.power.ups.upsd.listen;
|
||||
enable = youko.power.ups.enable;
|
||||
mode = youko.power.ups.mode;
|
||||
upsmonEnable = youko.power.ups.upsmon.enable;
|
||||
killPowerEnable = youko.systemd.services.ups-killpower.enable or false;
|
||||
upsdListen = youko.power.ups.upsd.listen;
|
||||
driver = ups.driver or null;
|
||||
port = ups.port or null;
|
||||
vendorId = builtins.elem "vendorid = 0665" (ups.directives or [ ]);
|
||||
|
||||
Reference in new issue
Block a user