summary refs log tree commit diff
diff options
context:
space:
mode:
-rw-r--r--gnu/services/monitoring.scm17
1 files 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 <shepherd-service> 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)