monitoring: add nixos-exporter to monitoring01
Some checks failed
Run nix flake check / flake-check (push) Has been cancelled

Enable the nixos-exporter prometheus exporter with flake collector
to track NixOS generation metrics and flake revision status.

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
This commit is contained in:
2026-02-06 23:04:12 +01:00
parent f2c30cc24f
commit bb9d489ab0
3 changed files with 44 additions and 0 deletions

21
flake.lock generated
View File

@@ -42,6 +42,26 @@
"url": "https://git.t-juice.club/torjus/labmon" "url": "https://git.t-juice.club/torjus/labmon"
} }
}, },
"nixos-exporter": {
"inputs": {
"nixpkgs": [
"nixpkgs-unstable"
]
},
"locked": {
"lastModified": 1770415085,
"narHash": "sha256-8XhzLc9wIoxL/OwKmX9LxpYCbmz3iMuuAX/4ILnw2TQ=",
"ref": "refs/heads/master",
"rev": "858e047bff6224c90ff5d033f8adbbba01036029",
"revCount": 2,
"type": "git",
"url": "https://git.t-juice.club/torjus/nixos-exporter"
},
"original": {
"type": "git",
"url": "https://git.t-juice.club/torjus/nixos-exporter"
}
},
"nixpkgs": { "nixpkgs": {
"locked": { "locked": {
"lastModified": 1770136044, "lastModified": 1770136044,
@@ -78,6 +98,7 @@
"inputs": { "inputs": {
"alerttonotify": "alerttonotify", "alerttonotify": "alerttonotify",
"labmon": "labmon", "labmon": "labmon",
"nixos-exporter": "nixos-exporter",
"nixpkgs": "nixpkgs", "nixpkgs": "nixpkgs",
"nixpkgs-unstable": "nixpkgs-unstable", "nixpkgs-unstable": "nixpkgs-unstable",
"sops-nix": "sops-nix" "sops-nix": "sops-nix"

View File

@@ -17,6 +17,10 @@
url = "git+https://git.t-juice.club/torjus/labmon?ref=master"; url = "git+https://git.t-juice.club/torjus/labmon?ref=master";
inputs.nixpkgs.follows = "nixpkgs-unstable"; inputs.nixpkgs.follows = "nixpkgs-unstable";
}; };
nixos-exporter = {
url = "git+https://git.t-juice.club/torjus/nixos-exporter";
inputs.nixpkgs.follows = "nixpkgs-unstable";
};
}; };
outputs = outputs =
@@ -27,6 +31,7 @@
sops-nix, sops-nix,
alerttonotify, alerttonotify,
labmon, labmon,
nixos-exporter,
... ...
}@inputs: }@inputs:
let let
@@ -180,6 +185,7 @@
./hosts/monitoring01 ./hosts/monitoring01
sops-nix.nixosModules.sops sops-nix.nixosModules.sops
labmon.nixosModules.labmon labmon.nixosModules.labmon
nixos-exporter.nixosModules.default
]; ];
}; };
jelly01 = nixpkgs.lib.nixosSystem { jelly01 = nixpkgs.lib.nixosSystem {

View File

@@ -99,6 +99,23 @@
]; ];
}; };
# NixOS metrics exporter
services.prometheus.exporters.nixos = {
enable = true;
flake = {
enable = true;
url = "git+https://git.t-juice.club/torjus/nixos-servers.git";
};
};
# Register nixos-exporter as a Prometheus scrape target
homelab.monitoring.scrapeTargets = [
{
job_name = "nixos-exporter";
port = 9971;
}
];
labmon = { labmon = {
enable = true; enable = true;