Changeset 34492


Ignore:
Timestamp:
2012-12-04T17:21:02+01:00 (5 years ago)
Author:
florian
Message:

zabbix: correct pidfile und update initscript

zabbix_agentd will not start because the initscript checks an old
path to the configfile and then zabbix_agentd uses the new path.
(old /etc/zabbix/zabbix_agentd.conf new /etc/zabbix_agentd.conf)
I think the new path is better as most people have only one zabbix
tool installed on their embedded device.

Further there is a problem with the pid-file: zabbix creates it by
default in /tmp, and the init script creates a folder in
/var/run/zabbix where the pid-file is expected. start-stop-daemon will
not find the pid-file and cannot stop zabbix_agentd. So I changed the
initscript and conffile to use the same pid-file. I actually chose
/var/run/zabbix_agentd.conf instead of creating a subfolder or use /tmp.

While doing that I redid the whole initscript and changed additionally:

  • move conffile to new location if is in the location from before changeset #32497
  • only create zabbix users if there is no AllowRoot=1 in config
  • only support the pid-file path /var/run/zabbix_agentd.pid, check it in initscript and warn if it is changed.
  • don't log to a file in /tmp, but use syslog
  • only start one passive check agent instead of default 3
  • don't search actively for a zabbix-server on 127.0.0.1
  • don't set the hostname to "Zabbix server" but use system.hostname

Signed-off-by: Stefan Hellermann <stefan@…>
Signed-off-by: Florian Fainelli <florian@…>

Location:
packages/admin/zabbix
Files:
1 added
1 edited

Legend:

Unmodified
Added
Removed
  • packages/admin/zabbix/files/zabbix_agentd.init

    r28892 r34492  
    44START=60 
    55 
    6 SERVICE_PID_FILE=/var/run/zabbix/zabbix_agentd.pid 
     6PROG=/usr/sbin/zabbix_agentd 
     7CONFIG=/etc/zabbix_agentd.conf 
     8SERVICE_PID_FILE=/var/run/zabbix_agentd.pid 
    79 
    810start() { 
    9         [ -f /etc/zabbix/zabbix_agentd.conf ] || return 1 
    10         user_exists zabbix 53 || user_add zabbix 53 
    11         group_exists zabbix 53 || group_add zabbix 53 
    12         [ -d /var/log/zabbix ] || { 
    13                 mkdir -m0755 -p /var/log/zabbix 
    14                 chown zabbix:zabbix /var/log/zabbix 
     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} 
     13 
     14        [ -f ${CONFIG} ] || return 1 
     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 
    1519        } 
    16         [ -d /var/run/zabbix ] || { 
    17                 mkdir -m0755 -p /var/run/zabbix 
    18                 chown zabbix:zabbix /var/run/zabbix 
     20 
     21        grep -q "^AllowRoot=1" ${CONFIG} || { 
     22                user_exists zabbix 53 || user_add zabbix 53 
     23                group_exists zabbix 53 || group_add zabbix 53 
     24                touch ${SERVICE_PID_FILE} 
     25                chown zabbix:zabbix ${SERVICE_PID_FILE} 
    1926        } 
    20         service_start /usr/sbin/zabbix_agentd 
     27 
     28        service_start ${PROG} -c ${CONFIG} 
    2129} 
    2230 
    2331stop() { 
    24         service_stop /usr/sbin/zabbix_agentd 
     32        service_stop ${PROG} 
    2533} 
Note: See TracChangeset for help on using the changeset viewer.