Ad Widget

Collapse

Zabbix-agentd deletes pid *directory*?

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • awmcclain
    Junior Member
    • Aug 2008
    • 1

    #1

    Zabbix-agentd deletes pid *directory*?

    My daemon is set up to create its pidfile in /var/run/zabbix-agent/ in both /etc/zabbix/zabbix-agentd.conf and /etc/init.d/zabbix-agent (as per the default in zabbix-agent 1.4.1-2 in ubuntu gutsy)

    However, whenever the server restarts, the /var/run/zabbix-agent/ directory gets deleted! What gives? I'm tired of having to manually recreate the directory after every reboot.
  • troffasky
    Senior Member
    • Jul 2008
    • 567

    #2
    Is this on Ubuntu by any chance? I had a similar problem, although MySQL corrupted all the .frm files before I managed to fix it.

    Comment

    • luximinator
      Junior Member
      • Jan 2009
      • 6

      #3
      Zabbix pid - solution

      Good morning althogether,

      I got this problem on two identical Zabbix installations, too. They're both running under an Ubuntu 8.04 LTS Desktop, updated to 8.10.

      Everey reboot, the agent's pid-file gets deleted and you have to create this directory and file manually by console.

      So I had a closer look-up to my configuration, as Zabbix is already mentioned, installed in standard options: both conf-files had the correct path /var/run/zabbix-*/zabbix_*.pid.

      So there must be another mistake. Zabbix daemons should be started every system boot up, the log files show instead of this, server started but agent failed: missing pid.

      In this cases I got two kind of this problem. Just have a look at your Zabbix start skripts in /etc/init.d, there's a simple mistake in the code.

      Case 1:

      Agent's file:
      Code:
      [...] 
      DAEMON=/usr/sbin/zabbix_agentd 
      NAME=zabbix_agentd 
      DESC="Zabbix agent" 
      PID=/var/run/[B]zabbix-agent[/B]/$NAME.pid 
      test -f $DAEMON || exit 0 
      [...]
      Server's file:
      Code:
      [...] 
      DAEMON=/usr/sbin/zabbix_server 
      NAME=zabbix_server 
      DESC="Zabbix server" 
      PID=/var/run/[B]zabbix-agent[/B]/$NAME.pid 
      test -f $DAEMON || exit 0 
      [...]
      As you can see, both files got PID=/var/run/zabbix-agent/$NAME.pid as file path for the pid. Change the wrong one to the correct path and save the file.



      Case 2:

      Code:
      [...] 
      PID=/var/run/zabbix-agent/$NAME.pid 
       
      test -f $DAEMON || exit 0 
       
      set -e 
       
      [B]if ! [ -d 'dirname $PID' ]; then  
               mkdir -p 'dirname $PID' 
               chown zabbix:zabbix 'dirname $PID' [/B]
       
      fi 
       
      export PATH="${PATH:+$PATH:}/usr/sbin:/sbin 
       
      case "$1" in 
      [...]

      In this case, in one of both files - here the agent's one for my second installation - there's missing a part (bold marked).
      Check your scripts and insert the missing part, save it and reboot.



      In both cases, wrong path and missing parts, and the solutions described here, my Zabbix daemons started correctly after reboot without any problems The procedure is also logged in the log-files, so you can check it.

      Have a try and post your experiences with my hints.

      Have a nice day
      Luximinator

      Comment

      • troffasky
        Senior Member
        • Jul 2008
        • 567

        #4
        See also:

        Same Problem as in "#96644 zabbix_agentd will not start after reboot" Here is a fixed version of /etc/init.d/zabbix-server #! /bin/sh ### BEGIN INIT INFO # Provides: zabbix-server # Required-Start: $local_fs $network # Required-Stop: $local_fs # Default-Start: S # Default-Stop: 0 6 # Short-Description: Start zabbix-server daemon ### END INIT INFO DAEMON=/usr/sbin/zabbix_server NAME=zabbix_server DESC="Zabbix server" PID=/var/run/zabbix-server/$NAME.pid ### BEGIN /v...


        Binary package hint: zabbix-agent The init script /etc/init.d/zabbix-agent expects the directory /var/run/zabbix-agent to exist, and fails to start if the pid can't be written to /var/run/zabbix-agent/zabbix_agentd.pid . Since the /var/run path is mounted as tmpfs, this directory is removed whenever the machine is rebooted. The directory can be created at zabbix-agent start by altering the script /etc/init.d/zabbix-agent as follows: #! /bin/sh ### BEGIN INIT INFO # Provides: zabb...


        Can't believe this bug is still dragging on!

        Comment

        • tekknokrat
          Senior Member
          • Sep 2008
          • 140

          #5
          current 1.6.2pre packages contain a fix for this issue.

          Comment

          Working...