From 79da28b33e40abfb507dc7414aa9d32dfd08b707 Mon Sep 17 00:00:00 2001
From: Florian Sesser <florian@private.storage>
Date: Wed, 3 Nov 2021 21:41:36 +0000
Subject: [PATCH] Move megacli2prom to a place where only the machines with
 such cards use it

---
 morph/grid/production/grid.nix | 8 ++++++++
 morph/lib/storage.nix          | 6 ------
 2 files changed, 8 insertions(+), 6 deletions(-)

diff --git a/morph/grid/production/grid.nix b/morph/grid/production/grid.nix
index ec0c1b37..5fd17f66 100644
--- a/morph/grid/production/grid.nix
+++ b/morph/grid/production/grid.nix
@@ -70,6 +70,10 @@ let
       # Slightly awkwardly, enable some of our hardware / network / bootloader options.
       ../../../nixos/modules/100tb.nix
 
+      # At least some of our storage nodes utilize MegaRAID storage controllers.
+      # Monitor their array status.
+      ../../../nixos/modules/monitoring/exporters/megacli2prom.nix
+
       # Get all of the configuration that is common across all storage nodes.
       gridlib.storage
 
@@ -88,6 +92,10 @@ let
     # name is quoted because `1` makes `100tb` look an awful lot like a
     # number.
    "100tb".config = nodecfg;
+
+    # Enable statistics gathering for MegaRAID cards.
+    # TODO would be nice to enable only on machines that have such a device.
+    services.private-storage.monitoring.megacli2prom.enable = true;
   };
 
   # Define all of the storage nodes for this grid.
diff --git a/morph/lib/storage.nix b/morph/lib/storage.nix
index 92adc653..86e14228 100644
--- a/morph/lib/storage.nix
+++ b/morph/lib/storage.nix
@@ -43,14 +43,8 @@ in {
     ../../nixos/modules/monitoring/vpn/client.nix
     # Expose base system metrics over the monitoringvpn.
     ../../nixos/modules/monitoring/exporters/node.nix
-    # At least some of our storage nodes utilize MegaRAID storage controllers.
-    ../../nixos/modules/monitoring/exporters/megacli2prom.nix
   ];
 
-  # Enable statistics gathering for MegaRAID cards.
-  # TODO would be nice to enable only on machines that have such a device.
-  services.private-storage.monitoring.megacli2prom.enable = true;
-
   # Turn on the Private Storage (Tahoe-LAFS) service.
   services.private-storage = {
     # Yep.  Turn it on.
-- 
GitLab