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.
This commit is contained in:
Marius Bakke 2022-02-01 19:28:42 +01:00
parent a8d1e6bfa2
commit e301f1a8ed
No known key found for this signature in database
GPG Key ID: A2A06DF2A33A54FA
2 changed files with 52 additions and 71 deletions

View File

@ -47,7 +47,7 @@ Copyright @copyright{} 2017, 2018 Carlo Zancanaro@*
Copyright @copyright{} 2017 Thomas Danckaert@* Copyright @copyright{} 2017 Thomas Danckaert@*
Copyright @copyright{} 2017 humanitiesNerd@* Copyright @copyright{} 2017 humanitiesNerd@*
Copyright @copyright{} 2017, 2021 Christine Lemmer-Webber@* 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 Hartmut Goebel@*
Copyright @copyright{} 2017, 2019, 2020, 2021 Maxim Cournoyer@* Copyright @copyright{} 2017, 2019, 2020, 2021 Maxim Cournoyer@*
Copyright @copyright{} 20172022 Tobias Geerinckx-Rice@* Copyright @copyright{} 20172022 Tobias Geerinckx-Rice@*
@ -25797,71 +25797,46 @@ This service provides a WEB interface to Zabbix server.
@c %start of fragment @c %start of fragment
@deftp {Data Type} zabbix-front-end-configuration
Available @code{zabbix-front-end-configuration} fields are: Available @code{zabbix-front-end-configuration} fields are:
@deftypevr {@code{zabbix-front-end-configuration} parameter} nginx-server-configuration-list nginx @table @asis
NGINX configuration. @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. Database host name.
Defaults to @samp{"localhost"}. @item @code{db-port} (default: @code{5432}) (type: number)
@end deftypevr
@deftypevr {@code{zabbix-front-end-configuration} parameter} number db-port
Database port. Database port.
Defaults to @samp{5432}. @item @code{db-name} (default: @code{\"zabbix\"}) (type: string)
@end deftypevr
@deftypevr {@code{zabbix-front-end-configuration} parameter} string db-name
Database name. Database name.
Defaults to @samp{"zabbix"}. @item @code{db-user} (default: @code{\"zabbix\"}) (type: string)
@end deftypevr
@deftypevr {@code{zabbix-front-end-configuration} parameter} string db-user
Database user. Database user.
Defaults to @samp{"zabbix"}. @item @code{db-password} (default: @code{\"\"}) (type: string)
@end deftypevr
@deftypevr {@code{zabbix-front-end-configuration} parameter} string db-password
Database password. Please, use @code{db-secret-file} instead. Database password. Please, use @code{db-secret-file} instead.
Defaults to @samp{""}. @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.
@end deftypevr @item @code{zabbix-host} (default: @code{\"localhost\"}) (type: string)
@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
Zabbix server hostname. Zabbix server hostname.
Defaults to @samp{"localhost"}. @item @code{zabbix-port} (default: @code{10051}) (type: number)
@end deftypevr
@deftypevr {@code{zabbix-front-end-configuration} parameter} number zabbix-port
Zabbix server port. Zabbix server port.
Defaults to @samp{10051}. @end table
@end deftypevr @end deftp
@c %end of fragment @c %end of fragment

View File

@ -50,8 +50,7 @@
zabbix-agent-configuration zabbix-agent-configuration
zabbix-agent-service-type zabbix-agent-service-type
zabbix-front-end-configuration zabbix-front-end-configuration
zabbix-front-end-service-type zabbix-front-end-service-type))
%zabbix-front-end-configuration-nginx))
;;; ;;;
@ -552,30 +551,37 @@ configuration file."))
,zabbix-agent-configuration-fields)) ,zabbix-agent-configuration-fields))
'zabbix-agent-configuration)) 'zabbix-agent-configuration))
(define %zabbix-front-end-configuration-nginx (define zabbix-front-end-nginx-configuration
(match-lambda
(($ <zabbix-front-end-configuration> _ package fastcgi-params)
(list
(nginx-server-configuration (nginx-server-configuration
(root #~(string-append #$zabbix-server:front-end "/share/zabbix/php")) (root #~(string-append #$package:front-end "/share/zabbix/php"))
(index '("index.php")) (index '("index.php"))
(locations (locations
(let ((php-location (nginx-php-location))) (let ((php-location (nginx-php-location)))
(list (nginx-location-configuration (list (nginx-location-configuration
(inherit php-location) (inherit php-location)
(body (append (nginx-location-configuration-body php-location) (body
(list " (append (nginx-location-configuration-body php-location)
fastcgi_param PHP_VALUE \"post_max_size = 16M (list
max_execution_time = 300\"; (format #f "fastcgi_param PHP_VALUE \"~a\";"
"))))))) (string-join
(listen '("80")))) (map (match-lambda
((key . value)
(format #f "~a = ~a~%"
key value)))
fastcgi-params))))))))))
(listen '("80")))))))
(define-configuration zabbix-front-end-configuration (define-configuration zabbix-front-end-configuration
;; TODO: Specify zabbix front-end package. (zabbix-server
;; (zabbix- (file-like zabbix-server)
;; (file-like zabbix-front-end) "The Zabbix server package to use.")
;; "The zabbix-front-end package.") (fastcgi-params
(nginx (list '(("post_max_size" . "16M")
(nginx-server-configuration-list ("max_execution_time" . "300")))
(list %zabbix-front-end-configuration-nginx)) "List of FastCGI parameter pairs that will be included in the NGINX configuration.")
"NGINX configuration.")
(db-host (db-host
(string "localhost") (string "localhost")
"Database host name.") "Database host name.")
@ -680,7 +686,7 @@ $IMAGE_FORMAT_DEFAULT = IMAGE_FORMAT_PNG;
(list (service-extension activation-service-type (list (service-extension activation-service-type
zabbix-front-end-activation) zabbix-front-end-activation)
(service-extension nginx-service-type (service-extension nginx-service-type
zabbix-front-end-configuration-nginx) zabbix-front-end-nginx-configuration)
;; Make sure php-fpm is instantiated. ;; Make sure php-fpm is instantiated.
(service-extension php-fpm-service-type (service-extension php-fpm-service-type
(const #t)))) (const #t))))