Browse Source

zabbix: switch zabbix_agentd to procd

run tested on ar71xx

Signed-off-by: Etienne CHAMPETIER <champetier.etienne@gmail.com>
Etienne CHAMPETIER 9 years ago
parent
commit
f58e0a6407

+ 6
- 16
admin/zabbix/files/zabbix_agentd.init View File

3
 
3
 
4
 START=60
4
 START=60
5
 
5
 
6
+USE_PROCD=1
6
 PROG=/usr/sbin/zabbix_agentd
7
 PROG=/usr/sbin/zabbix_agentd
7
 CONFIG=/etc/zabbix_agentd.conf
8
 CONFIG=/etc/zabbix_agentd.conf
8
-SERVICE_PID_FILE=/var/run/zabbix_agentd.pid
9
 
9
 
10
-start() {
10
+start_service() {
11
 	# Sometimes the agentd config was installed in /etc/zabbix/zabbix_agentd.conf
11
 	# Sometimes the agentd config was installed in /etc/zabbix/zabbix_agentd.conf
12
 	[ -f /etc/zabbix/zabbix_agentd.conf ] && mv /etc/zabbix/zabbix_agentd.conf ${CONFIG}
12
 	[ -f /etc/zabbix/zabbix_agentd.conf ] && mv /etc/zabbix/zabbix_agentd.conf ${CONFIG}
13
 
13
 
14
 	[ -f ${CONFIG} ] || return 1
14
 	[ -f ${CONFIG} ] || return 1
15
 
15
 
16
-	grep -q "^PidFile=${SERVICE_PID_FILE}" ${CONFIG} || {
17
-		logger -s -t ${CONFIG} -p daemon.error "Only \"PidFile=${SERVICE_PID_FILE}\" supported"
18
-		return 1
19
-	}
20
-
21
-	grep -q "^AllowRoot=1" ${CONFIG} || {
22
-		touch ${SERVICE_PID_FILE}
23
-		chown zabbix:zabbix ${SERVICE_PID_FILE}
24
-	}
25
-
26
-	service_start ${PROG} -c ${CONFIG}
16
+	procd_open_instance
17
+	procd_set_param command ${PROG} -c ${CONFIG} -f
18
+	procd_set_param respawn
19
+	procd_close_instance
27
 }
20
 }
28
 
21
 
29
-stop() {
30
-	service_stop ${PROG}
31
-}

+ 2
- 2
admin/zabbix/patches/010-change-agentd-config.patch View File

10
 -# Mandatory: no
10
 -# Mandatory: no
11
 -# Default:
11
 -# Default:
12
 -# PidFile=/tmp/zabbix_agentd.pid
12
 -# PidFile=/tmp/zabbix_agentd.pid
13
-+# Only /var/run/zabbix_agentd.pid supported
14
-+PidFile=/var/run/zabbix_agentd.pid
13
++# We do not need PidFile with procd
14
++# PidFile=/var/run/zabbix_agentd.pid
15
  
15
  
16
  ### Option: LogFile
16
  ### Option: LogFile
17
  #	Name of log file.
17
  #	Name of log file.