diff options
Diffstat (limited to 'gnu/services/monitoring.scm')
-rw-r--r-- | gnu/services/monitoring.scm | 43 |
1 files changed, 26 insertions, 17 deletions
diff --git a/gnu/services/monitoring.scm b/gnu/services/monitoring.scm index 9c8704092c..44e2e8886c 100644 --- a/gnu/services/monitoring.scm +++ b/gnu/services/monitoring.scm @@ -224,15 +224,12 @@ Prometheus.") (define (serialize-string field-name val) - (if (and (string? val) (string=? val "")) + (if (or (eq? 'user field-name) + (eq? 'group field-name) + (and (string? val) (string=? val ""))) "" (serialize-field field-name val))) -(define group? string?) - -(define serialize-group - (const "")) - (define include-files? list?) (define (serialize-include-files field-name val) @@ -256,8 +253,8 @@ Prometheus.") (user (string "zabbix") "User who will run the Zabbix server.") - (group ;for zabbix-server-account procedure - (group "zabbix") + (group + (string "zabbix") "Group who will run the Zabbix server.") (db-host (string "127.0.0.1") @@ -407,7 +404,10 @@ configuration file.")) /etc/ssl/certs" "SSL_CERT_FILE=/run/current-system/profile\ /etc/ssl/certs/ca-certificates.crt"))) - (stop #~(make-kill-destructor)))))) + (stop #~(make-kill-destructor + ;; The server needs to finish database work on shutdown + ;; which can take a while for big or busy databases. + #:grace-period 60)))))) (define zabbix-server-service-type (service-type @@ -438,7 +438,7 @@ results in a Web interface."))) (string "zabbix") "User who will run the Zabbix agent.") (group - (group "zabbix") + (string "zabbix") "Group who will run the Zabbix agent.") (hostname (string "") @@ -516,6 +516,18 @@ configuration file.")) (format port #$(serialize-configuration config zabbix-agent-configuration-fields))))))) +(define (zabbix-agent-arguments config) + #~(let* ((config-file #$(zabbix-agent-config-file config)) + (agent #$(zabbix-agent-configuration-zabbix-agent config)) + (agent2? (file-exists? (string-append agent "/sbin/zabbix_agent2")))) + (if agent2? + (list (string-append agent "/sbin/zabbix_agent2") + "-config" config-file + "-foreground") + (list (string-append agent "/sbin/zabbix_agentd") + "--config" config-file + "--foreground")))) + (define (zabbix-agent-shepherd-service config) "Return a <shepherd-service> for Zabbix agent with CONFIG." (list (shepherd-service @@ -523,10 +535,7 @@ configuration file.")) (requirement '(user-processes)) (documentation "Run Zabbix agent daemon.") (start #~(make-forkexec-constructor - (list #$(file-append (zabbix-agent-configuration-zabbix-agent config) - "/sbin/zabbix_agentd") - "--config" #$(zabbix-agent-config-file config) - "--foreground") + #$(zabbix-agent-arguments config) #:user #$(zabbix-agent-configuration-user config) #:group #$(zabbix-agent-configuration-group config) #:pid-file #$(zabbix-agent-configuration-pid-file config) @@ -576,7 +585,7 @@ fastcgi_param PHP_VALUE \"post_max_size = 16M (define (zabbix-front-end-nginx-extension config) (match config - (($ <zabbix-front-end-configuration> _ server nginx) + (($ <zabbix-front-end-configuration> server nginx) (if (null? nginx) (list (nginx-server-configuration @@ -622,8 +631,8 @@ create it manually.") (define (zabbix-front-end-config config) (match-record config <zabbix-front-end-configuration> - (%location db-host db-port db-name db-user db-password db-secret-file - zabbix-host zabbix-port) + (db-host db-port db-name db-user db-password db-secret-file + zabbix-host zabbix-port %location) (mixed-text-file "zabbix.conf.php" "\ <?php |