summaryrefslogtreecommitdiff
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
parenta8d1e6bfa22c3f7f14e37584848e08a953ea4e02 (diff)
downloadguix-patches-e301f1a8ed11f9eacb2b7f525a7446dc00621a8b.tar
guix-patches-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.
-rw-r--r--doc/guix.texi67
-rw-r--r--gnu/services/monitoring.scm56
2 files changed, 52 insertions, 71 deletions
diff --git a/doc/guix.texi b/doc/guix.texi
index 10248d29e7..1a6c364ac8 100644
--- a/doc/guix.texi
+++ b/doc/guix.texi
@@ -47,7 +47,7 @@ Copyright @copyright{} 2017, 2018 Carlo Zancanaro@*
Copyright @copyright{} 2017 Thomas Danckaert@*
Copyright @copyright{} 2017 humanitiesNerd@*
Copyright @copyright{} 2017, 2021 Christine Lemmer-Webber@*
-Copyright @copyright{} 2017, 2018, 2019, 2020, 2021 Marius Bakke@*
+Copyright @copyright{} 2017, 2018, 2019, 2020, 2021, 2022 Marius Bakke@*
Copyright @copyright{} 2017, 2019, 2020 Hartmut Goebel@*
Copyright @copyright{} 2017, 2019, 2020, 2021 Maxim Cournoyer@*
Copyright @copyright{} 2017–2022 Tobias Geerinckx-Rice@*
@@ -25797,71 +25797,46 @@ This service provides a WEB interface to Zabbix server.
@c %start of fragment
+@deftp {Data Type} zabbix-front-end-configuration
Available @code{zabbix-front-end-configuration} fields are:
-@deftypevr {@code{zabbix-front-end-configuration} parameter} nginx-server-configuration-list nginx
-NGINX configuration.
+@table @asis
+@item @code{zabbix-server} (default: @code{zabbix-server}) (type: file-like)
+The Zabbix server package to use.
-@end deftypevr
+@item @code{fastcgi-params} (type: list)
+List of FastCGI parameter pairs that will be included in the NGINX
+configuration.
-@deftypevr {@code{zabbix-front-end-configuration} parameter} string db-host
+@item @code{db-host} (default: @code{\"localhost\"}) (type: string)
Database host name.
-Defaults to @samp{"localhost"}.
-
-@end deftypevr
-
-@deftypevr {@code{zabbix-front-end-configuration} parameter} number db-port
+@item @code{db-port} (default: @code{5432}) (type: number)
Database port.
-Defaults to @samp{5432}.
-
-@end deftypevr
-
-@deftypevr {@code{zabbix-front-end-configuration} parameter} string db-name
+@item @code{db-name} (default: @code{\"zabbix\"}) (type: string)
Database name.
-Defaults to @samp{"zabbix"}.
-
-@end deftypevr
-
-@deftypevr {@code{zabbix-front-end-configuration} parameter} string db-user
+@item @code{db-user} (default: @code{\"zabbix\"}) (type: string)
Database user.
-Defaults to @samp{"zabbix"}.
-
-@end deftypevr
-
-@deftypevr {@code{zabbix-front-end-configuration} parameter} string db-password
+@item @code{db-password} (default: @code{\"\"}) (type: string)
Database password. Please, use @code{db-secret-file} instead.
-Defaults to @samp{""}.
-
-@end deftypevr
+@item @code{db-secret-file} (default: @code{\"\"}) (type: string)
+Secret file which will be appended to @file{zabbix.conf.php} file. This
+file contains credentials for use by Zabbix front-end. You are expected
+to create it manually.
-@deftypevr {@code{zabbix-front-end-configuration} parameter} string db-secret-file
-Secret file containing the credentials for the Zabbix front-end. The value
-must be a local file name, not a G-expression. You are expected to create
-this file manually. Its contents will be copied into @file{zabbix.conf.php}
-as the value of @code{$DB['PASSWORD']}.
-
-Defaults to @samp{""}.
-
-@end deftypevr
-
-@deftypevr {@code{zabbix-front-end-configuration} parameter} string zabbix-host
+@item @code{zabbix-host} (default: @code{\"localhost\"}) (type: string)
Zabbix server hostname.
-Defaults to @samp{"localhost"}.
-
-@end deftypevr
-
-@deftypevr {@code{zabbix-front-end-configuration} parameter} number zabbix-port
+@item @code{zabbix-port} (default: @code{10051}) (type: number)
Zabbix server port.
-Defaults to @samp{10051}.
+@end table
-@end deftypevr
+@end deftp
@c %end of fragment
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))))