From 40153fe03358a69c1b2f53237511f73ee83910a2 Mon Sep 17 00:00:00 2001 From: Marius Bakke Date: Wed, 7 Dec 2022 18:47:10 +0100 Subject: services: zabbix-agent: Adjust command-line when using zabbix_agent2. * gnu/services/monitoring.scm (zabbix-agent-arguments): New procedure. (zabbix-agent-shepherd-service): Use that to determine command line arguments. --- gnu/services/monitoring.scm | 17 +++++++++++++---- 1 file changed, 13 insertions(+), 4 deletions(-) diff --git a/gnu/services/monitoring.scm b/gnu/services/monitoring.scm index f12b7acb1f..9a88351566 100644 --- a/gnu/services/monitoring.scm +++ b/gnu/services/monitoring.scm @@ -513,6 +513,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 for Zabbix agent with CONFIG." (list (shepherd-service @@ -520,10 +532,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) -- cgit 1.4.1