summary refs log tree commit diff
path: root/gnu/services/monitoring.scm
diff options
context:
space:
mode:
authorMarius Bakke <marius@gnu.org>2022-02-01 19:28:42 +0100
committerMarius Bakke <marius@gnu.org>2022-02-01 23:46:05 +0100
commite301f1a8ed11f9eacb2b7f525a7446dc00621a8b (patch)
tree4c7264e107639014165f8f0add83441144a7b080 /gnu/services/monitoring.scm
parenta8d1e6bfa22c3f7f14e37584848e08a953ea4e02 (diff)
downloadguix-e301f1a8ed11f9eacb2b7f525a7446dc00621a8b.tar.gz
services: zabbix-frontend: Support custom server package.
* gnu/services/monitoring.scm (%zabbix-front-end-configuration-nginx): Rename
to ...
(zabbix-front-end-nginx-configuration): ... this.  Take server package and
FastCGI parameters from ...
(zabbix-front-end-configuration): ... here.  Add PACKAGE and FASTCGI-PARAMS
fields, remove NGINX.
(zabbix-front-end-service-type): Adjust for renamed procedure.
* doc/guix.texi (Monitoring Services)[Zabbix front-end]: Regenerate documentation.
Diffstat (limited to 'gnu/services/monitoring.scm')
-rw-r--r--gnu/services/monitoring.scm56
1 files changed, 31 insertions, 25 deletions
diff --git a/gnu/services/monitoring.scm b/gnu/services/monitoring.scm
index 398fe0bb8b..fb893d87cd 100644
--- a/gnu/services/monitoring.scm
+++ b/gnu/services/monitoring.scm
@@ -50,8 +50,7 @@
             zabbix-agent-configuration
             zabbix-agent-service-type
             zabbix-front-end-configuration
-            zabbix-front-end-service-type
-            %zabbix-front-end-configuration-nginx))
+            zabbix-front-end-service-type))
 
 
 ;;;
@@ -552,30 +551,37 @@ configuration file."))
       ,zabbix-agent-configuration-fields))
    'zabbix-agent-configuration))
 
-(define %zabbix-front-end-configuration-nginx
-  (nginx-server-configuration
-   (root #~(string-append #$zabbix-server:front-end "/share/zabbix/php"))
-   (index '("index.php"))
-   (locations
-    (let ((php-location (nginx-php-location)))
-      (list (nginx-location-configuration
-             (inherit php-location)
-             (body (append (nginx-location-configuration-body php-location)
-                           (list "
-fastcgi_param PHP_VALUE \"post_max_size = 16M
-                          max_execution_time = 300\";
-")))))))
-   (listen '("80"))))
+(define zabbix-front-end-nginx-configuration
+  (match-lambda
+    (($ <zabbix-front-end-configuration> _ package fastcgi-params)
+     (list
+      (nginx-server-configuration
+       (root #~(string-append #$package:front-end "/share/zabbix/php"))
+       (index '("index.php"))
+       (locations
+        (let ((php-location (nginx-php-location)))
+          (list (nginx-location-configuration
+                 (inherit php-location)
+                 (body
+                  (append (nginx-location-configuration-body php-location)
+                          (list
+                           (format #f "fastcgi_param PHP_VALUE \"~a\";"
+                                   (string-join
+                                    (map (match-lambda
+                                           ((key . value)
+                                            (format #f "~a = ~a~%"
+                                                    key value)))
+                                         fastcgi-params))))))))))
+       (listen '("80")))))))
 
 (define-configuration zabbix-front-end-configuration
-  ;; TODO: Specify zabbix front-end package.
-  ;; (zabbix-
-  ;;  (file-like zabbix-front-end)
-  ;;  "The zabbix-front-end package.")
-  (nginx
-   (nginx-server-configuration-list
-    (list %zabbix-front-end-configuration-nginx))
-   "NGINX configuration.")
+  (zabbix-server
+    (file-like zabbix-server)
+    "The Zabbix server package to use.")
+  (fastcgi-params
+   (list '(("post_max_size" . "16M")
+           ("max_execution_time" . "300")))
+   "List of FastCGI parameter pairs that will be included in the NGINX configuration.")
   (db-host
    (string "localhost")
    "Database host name.")
@@ -680,7 +686,7 @@ $IMAGE_FORMAT_DEFAULT = IMAGE_FORMAT_PNG;
     (list (service-extension activation-service-type
                              zabbix-front-end-activation)
           (service-extension nginx-service-type
-                             zabbix-front-end-configuration-nginx)
+                             zabbix-front-end-nginx-configuration)
           ;; Make sure php-fpm is instantiated.
           (service-extension php-fpm-service-type
                              (const #t))))