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.
parent
10251c4456
commit
40153fe033
|
@ -513,6 +513,18 @@ configuration file."))
|
||||||
(format port #$(serialize-configuration
|
(format port #$(serialize-configuration
|
||||||
config zabbix-agent-configuration-fields)))))))
|
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)
|
(define (zabbix-agent-shepherd-service config)
|
||||||
"Return a <shepherd-service> for Zabbix agent with CONFIG."
|
"Return a <shepherd-service> for Zabbix agent with CONFIG."
|
||||||
(list (shepherd-service
|
(list (shepherd-service
|
||||||
|
@ -520,10 +532,7 @@ configuration file."))
|
||||||
(requirement '(user-processes))
|
(requirement '(user-processes))
|
||||||
(documentation "Run Zabbix agent daemon.")
|
(documentation "Run Zabbix agent daemon.")
|
||||||
(start #~(make-forkexec-constructor
|
(start #~(make-forkexec-constructor
|
||||||
(list #$(file-append (zabbix-agent-configuration-zabbix-agent config)
|
#$(zabbix-agent-arguments config)
|
||||||
"/sbin/zabbix_agentd")
|
|
||||||
"--config" #$(zabbix-agent-config-file config)
|
|
||||||
"--foreground")
|
|
||||||
#:user #$(zabbix-agent-configuration-user config)
|
#:user #$(zabbix-agent-configuration-user config)
|
||||||
#:group #$(zabbix-agent-configuration-group config)
|
#:group #$(zabbix-agent-configuration-group config)
|
||||||
#:pid-file #$(zabbix-agent-configuration-pid-file config)
|
#:pid-file #$(zabbix-agent-configuration-pid-file config)
|
||||||
|
|
Reference in New Issue