summary refs log tree commit diff
path: root/nixos/modules/services/monitoring/longview.nix
diff options
context:
space:
mode:
authorRodney Lorrimar <dev@rodney.id.au>2015-11-11 12:11:07 +0000
committerRodney Lorrimar <dev@rodney.id.au>2015-11-22 12:37:00 +0000
commit33c2b8a1f11b4f6632a28ff920e7b79da31ddb12 (patch)
tree373134add38873e8990a165c1664d1cf1becf2da /nixos/modules/services/monitoring/longview.nix
parentbc3fb7961976ce4d8c1df731f8cff1f97c14c27a (diff)
downloadnixpkgs-33c2b8a1f11b4f6632a28ff920e7b79da31ddb12.tar
nixpkgs-33c2b8a1f11b4f6632a28ff920e7b79da31ddb12.tar.gz
nixpkgs-33c2b8a1f11b4f6632a28ff920e7b79da31ddb12.tar.bz2
nixpkgs-33c2b8a1f11b4f6632a28ff920e7b79da31ddb12.tar.lz
nixpkgs-33c2b8a1f11b4f6632a28ff920e7b79da31ddb12.tar.xz
nixpkgs-33c2b8a1f11b4f6632a28ff920e7b79da31ddb12.tar.zst
nixpkgs-33c2b8a1f11b4f6632a28ff920e7b79da31ddb12.zip
longview nixos module: add config options for service monitoring
Diffstat (limited to 'nixos/modules/services/monitoring/longview.nix')
-rw-r--r--nixos/modules/services/monitoring/longview.nix53
1 files changed, 46 insertions, 7 deletions
diff --git a/nixos/modules/services/monitoring/longview.nix b/nixos/modules/services/monitoring/longview.nix
index b55f43b437b..955b33a5c0c 100644
--- a/nixos/modules/services/monitoring/longview.nix
+++ b/nixos/modules/services/monitoring/longview.nix
@@ -7,15 +7,15 @@ let
 
   pidFile = "/run/longview.pid";
 
-  apacheConf =  ''
-    #location http://127.0.0.1/server-status?auto
+  apacheConf = optionalString (cfg.apacheStatusUrl != "") ''
+    location ${cfg.apacheStatusUrl}?auto
   '';
-  mysqlConf = ''
-    #username root
-    #password example_password
+  mysqlConf = optionalString (cfg.mysqlUser != "") ''
+    username ${cfg.mysqlUser}
+    password ${cfg.mysqlPassword}
   '';
-  nginxConf = ''
-    #location http://127.0.0.1/nginx_status
+  nginxConf = optionalString (cfg.nginxStatusUrl != "") ''
+    location ${cfg.nginxStatusUrl}
   '';
 
 in
@@ -35,12 +35,51 @@ in
 
       apiKey = mkOption {
         type = types.str;
+        example = "01234567-89AB-CDEF-0123456789ABCDEF";
         description = ''
           Longview API key. To get this, look in Longview settings which
           are found at https://manager.linode.com/longview/.
         '';
       };
 
+      apacheStatusUrl = mkOption {
+        type = types.str;
+        default = "";
+        example = "http://127.0.0.1/server-status";
+        description = ''
+          The Apache status page URL. If provided, Longview will
+          gather statistics from this location. This requires Apache
+          mod_status to be loaded and enabled.
+        '';
+      };
+
+      nginxStatusUrl = mkOption {
+        type = types.str;
+        default = "";
+        example = "http://127.0.0.1/nginx_status";
+        description = ''
+          The Nginx status page URL. Longview will gather statistics
+          from this URL. This requires the Nginx stub_status module to
+          be enabled and configured at the given location.
+        '';
+      };
+
+      mysqlUser = mkOption {
+        type = types.str;
+        default = "";
+        description = ''
+          The user for connecting to the MySQL database. If provided,
+          Longview will connect to MySQL and collect statistics about
+          queries, etc.
+        '';
+      };
+
+      mysqlPassword = mkOption {
+        type = types.str;
+        description = ''
+          The password corresponding to mysqlUser.
+        '';
+      };
     };
 
   };