aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMarius Bakke <marius@gnu.org>2022-12-07 18:47:10 +0100
committerMarius Bakke <marius@gnu.org>2022-12-07 20:08:36 +0100
commit40153fe03358a69c1b2f53237511f73ee83910a2 (patch)
tree2c00af7dbd8f2b4f2c462b4e7fc7ceeee871bed5
parent10251c4456c4ec97a1f3604431241128f3e04729 (diff)
downloadguix-40153fe03358a69c1b2f53237511f73ee83910a2.tar
guix-40153fe03358a69c1b2f53237511f73ee83910a2.tar.gz
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.
-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)