Uploaded image for project: 'ZABBIX BUGS AND ISSUES'
  1. ZABBIX BUGS AND ISSUES
  2. ZBX-9517

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

XMLWordPrintable

    • Icon: Incident report Incident report
    • Resolution: Fixed
    • Icon: Trivial Trivial
    • None
    • 2.4.5
    • Agent (G)
    • 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
      

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

              Created:
              Updated:
              Resolved: