summaryrefslogtreecommitdiff
path: root/systems/atlas/victoria-metrics.nix
diff options
context:
space:
mode:
authorSeth Flynn <[email protected]>2025-02-14 23:56:03 -0500
committerSeth Flynn <[email protected]>2025-02-15 01:18:39 -0500
commiteb1267e54b3ff75c73ddb9c4f67041d21bf82caa (patch)
treef61180dfbf3a255c9f3aa7138d0b788029a19487 /systems/atlas/victoria-metrics.nix
parentc651506fe6ccfe88309bf6b7050cc43ec62de0e7 (diff)
atlas: host grafana + vm
Diffstat (limited to 'systems/atlas/victoria-metrics.nix')
-rw-r--r--systems/atlas/victoria-metrics.nix52
1 files changed, 52 insertions, 0 deletions
diff --git a/systems/atlas/victoria-metrics.nix b/systems/atlas/victoria-metrics.nix
new file mode 100644
index 0000000..25f0e57
--- /dev/null
+++ b/systems/atlas/victoria-metrics.nix
@@ -0,0 +1,52 @@
+{
+ lib,
+ inputs,
+ ...
+}:
+
+let
+ usesNodeExporter = system: system.config.services.prometheus.exporters.node.enable;
+
+ nodeExporterFrom =
+ system:
+ "http://${system.config.networking.hostName}:${toString system.config.services.prometheus.exporters.node.port}";
+
+ toNodeStaticConfig = system: {
+ targets = [ (nodeExporterFrom system) ];
+ labels.type = "node";
+ };
+
+ remoteNodes = lib.mapAttrsToList (lib.const toNodeStaticConfig) (
+ lib.filterAttrs (lib.const usesNodeExporter) inputs.self.nixosConfigurations
+ );
+in
+
+{
+ borealis = {
+ victorialogs = {
+ enable = true;
+ };
+ };
+
+ services = {
+ journald.upload.enable = true;
+
+ prometheus.exporters.node.enable = true;
+
+ victoriametrics = {
+ enable = true;
+
+ retentionPeriod = "7d";
+
+ prometheusConfig = {
+ scrape_configs = [
+ {
+ job_name = "node-exporter";
+ metrics_path = "/metrics";
+ static_configs = remoteNodes;
+ }
+ ];
+ };
+ };
+ };
+}