service zabbix-agent stop fails when PidFile missing from zabbix-agentd.conf

XMLWordPrintable

    • Type: Incident report
    • Resolution: Fixed
    • Priority: Trivial
    • None
    • Affects Version/s: 2.4.5
    • Component/s: Agent (G)
    • Environment:
      CentOS 6

      In zabbix-agent 2.4.5-1 on CentOS 6, the following line in /etc/init.d/zabbix-agent:

      killproc $prog

      Has been changed to:

      killproc -p $pidfile -d $timeout $prog

      With $pidfile defined as follows:

      conf=/etc/zabbix/zabbix_agentd.conf
      pidfile=$(grep -e "^PidFile=.*$" $conf | cut -d= -f2)
      

      If PidFile is not specified in /etc/zabbix/zabbix_agentd.conf, then $pidfile ends up empty, and killproc is called as:

      killproc -p -d 10 zabbix_agentd

      This causes killproc to mistake '-d' for the location of the PID file, and pass it as an argument to dirname, resulting in the following error:

      Shutting down Zabbix agent: /usr/bin/dirname: invalid option – 'd'

      Try `/usr/bin/dirname --help' for more information.
                                                                 [FAILED]
      

      To make the init script respect the default value of PidFile, you could do something like:

      conf=/etc/zabbix/zabbix_agentd.conf
      pidfile=$(grep -e "^PidFile=.*$" $conf | cut -d= -f2)
      [ -z $pidfile ] && pidfile=/tmp/zabbix_agentd.pid
      

            Assignee:
            Unassigned
            Reporter:
            Mark Grocock
            Votes:
            0 Vote for this issue
            Watchers:
            4 Start watching this issue

              Created:
              Updated:
              Resolved: