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 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{} 20172022 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{""}.
@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
@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

View file

@ -50,8 +50,7 @@ (define-module (gnu services monitoring)
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 @@ (define (generate-zabbix-agent-documentation)
,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 @@ (define zabbix-front-end-service-type
(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))))