summary refs log tree commit diff
path: root/nixos/modules/services/monitoring
diff options
context:
space:
mode:
authorDavid Smith <shmish111@gmail.com>2018-08-01 13:36:16 +0100
committerDavid Smith <shmish111@gmail.com>2018-09-07 09:46:46 +0100
commit1d497bbff1932942c1243650267d998ca7cbc6dd (patch)
tree17b9f0aa5cb088dc8a55a76baa05747c8dc78ec2 /nixos/modules/services/monitoring
parentb8c4f02131c8929ab6773a7693b9271bb51c0b16 (diff)
downloadnixlib-1d497bbff1932942c1243650267d998ca7cbc6dd.tar
nixlib-1d497bbff1932942c1243650267d998ca7cbc6dd.tar.gz
nixlib-1d497bbff1932942c1243650267d998ca7cbc6dd.tar.bz2
nixlib-1d497bbff1932942c1243650267d998ca7cbc6dd.tar.lz
nixlib-1d497bbff1932942c1243650267d998ca7cbc6dd.tar.xz
nixlib-1d497bbff1932942c1243650267d998ca7cbc6dd.tar.zst
nixlib-1d497bbff1932942c1243650267d998ca7cbc6dd.zip
nixos/riemann: refactor config
Previously it was only possible to use very simple Riemann config.
For more complicated scenarios you need a directory of clojure
files and the config file that riemann starts with should be in this
directory.
Diffstat (limited to 'nixos/modules/services/monitoring')
-rw-r--r--nixos/modules/services/monitoring/riemann.nix22
1 files changed, 18 insertions, 4 deletions
diff --git a/nixos/modules/services/monitoring/riemann.nix b/nixos/modules/services/monitoring/riemann.nix
index 237de53456f9..13d2b1cc0602 100644
--- a/nixos/modules/services/monitoring/riemann.nix
+++ b/nixos/modules/services/monitoring/riemann.nix
@@ -17,9 +17,9 @@ let
 
   launcher = writeScriptBin "riemann" ''
     #!/bin/sh
-    exec ${jdk}/bin/java ${concatStringsSep "\n" cfg.extraJavaOpts} \
+    exec ${jdk}/bin/java ${concatStringsSep " " cfg.extraJavaOpts} \
       -cp ${classpath} \
-      riemann.bin ${writeText "riemann-config.clj" riemannConfig}
+      riemann.bin ${cfg.configFile}
   '';
 
 in {
@@ -37,7 +37,8 @@ in {
       config = mkOption {
         type = types.lines;
         description = ''
-          Contents of the Riemann configuration file.
+          Contents of the Riemann configuration file. For more complicated
+          config you should use configFile.
         '';
       };
       configFiles = mkOption {
@@ -47,7 +48,15 @@ in {
           Extra files containing Riemann configuration. These files will be
           loaded at runtime by Riemann (with Clojure's
           <literal>load-file</literal> function) at the end of the
-          configuration.
+          configuration if you use the config option, this is ignored if you
+          use configFile.
+        '';
+      };
+      configFile = mkOption {
+        type = types.str;
+        description = ''
+          A Riemann config file. Any files in the same directory as this file
+          will be added to the classpath by Riemann.
         '';
       };
       extraClasspathEntries = mkOption {
@@ -77,6 +86,10 @@ in {
       group = "riemann";
     };
 
+    services.riemann.configFile = mkDefault (
+      writeText "riemann-config.clj" riemannConfig
+    );
+
     systemd.services.riemann = {
       wantedBy = [ "multi-user.target" ];
       path = [ inetutils ];
@@ -84,6 +97,7 @@ in {
         User = "riemann";
         ExecStart = "${launcher}/bin/riemann";
       };
+      serviceConfig.LimitNOFILE = 65536;
     };
 
   };