Ad Widget

Collapse

zabbix server process fails to start after reboot

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • chewy
    Junior Member
    • Dec 2015
    • 9

    #1

    zabbix server process fails to start after reboot

    I'm running the zabbix appliance (version 3.0.2 but technically I think it was 3.0.1 updated to 3.0.2) and everything is fine. After updating to 3.0.3 using the command in the docs (sudo apt-get --only-upgrade install zabbix*), the zabbix server process doesn't start if I reboot the appliance. In version 3.0.2, rebooting the appliance was fine.

    I see this in the logs after rebooting after 3.0.3 udpate:
    Code:
    using configuration file: /etc/zabbix/zabbix_server.conf
    [Z3001] connection to database 'zabbix' failed: [2002] Can't connect to local MySQL server through socket '/var/run/mysqld/mysqld.sock' (2)
    Cannot connect to the database. Exiting...
    In version 3.0.2 (I took a snapshot before updating and rolled back), it looks like this:
    Code:
    using configuration file: /etc/zabbix/zabbix_server.conf
    [Z3001] connection to database 'zabbix' failed: [2002] Can't connect to local MySQL server through socket '/var/run/mysqld/mysqld.sock' (2)
    database is down: reconnecting in 10 seconds
    database connection re-established
    I was looking around the support area to see if I could find a known issue and found ZBX-10753. Is this the same issue I'm seeing and is there nothing I can do until it's fixed (short of starting the process myself)?
  • informatom
    Junior Member
    • May 2016
    • 3

    #2
    same problem after upgrade

    I am seing the same problem after upgrade to Ubuntu 16.04 and zabbix-server-mysql 3.0.3.
    For me manual start works as well.

    Comment

    • DmitryL
      Senior Member
      Zabbix Certified SpecialistZabbix Certified Professional
      • May 2016
      • 278

      #3
      Hello chewy!

      Please check if MySQL server is running and also mysql log file.

      Comment

      • informatom
        Junior Member
        • May 2016
        • 3

        #4
        MYSQL Server is started

        ... properly, and the manual start of the Zabbix server a few seconds later succeeds.

        Maybe in 16.04 there has to be a different startup configuration because of systemd?

        Comment

        • chewy
          Junior Member
          • Dec 2015
          • 9

          #5
          Originally posted by Dmitryb
          Hello chewy!

          Please check if MySQL server is running and also mysql log file.
          Pretty sure it is running because like informatom, I can start the zabbix server manually.

          Seems like 3.0.2 tries to connect a few times before giving up but in 3.0.3 it tries once and gives up right away. Don't know if this is also true should there be any hiccup during normal usage (ie. try to reconnect only once before giving up)

          Comment

          • koreav
            Junior Member
            • May 2016
            • 1

            #6
            same problem on 3.0.3,
            we insert sleep 10 in /etc/init.d/zabbix-server
            ...
            case "$1" in
            start)
            log_daemon_msg "Starting $DESC" "$NAME"
            sleep 10
            start-stop-daemon --oknodo --start --pidfile $PID \
            ...

            Comment

            • informatom
              Junior Member
              • May 2016
              • 3

              #7
              No effect on Ubuntu 14.04

              Good idea: But on Ubuntu 14.04, where upstart has already be introduced,
              the right place is /etc/init/zabbix_server (not init.d).

              E.g. put a sleep 10 in between

              Code:
              pre-start script
                sleep 10
                # stop job from continuing if no config file found for daemon
              Can't fix my headline. Should be "fixed in Ubuntu 14.04 as well".
              Last edited by informatom; 31-05-2016, 09:05. Reason: Update: I found it

              Comment

              • jirijanata
                Junior Member
                • May 2014
                • 8

                #8
                Hi,

                I had same problem. I installed fresh Zabbix 3.0.3 on Ubuntu Server 14.04.4 following this guide:


                and after server restart was service zabbix-server not started automatically. So I opened file with vi (# sudo vi /etc/init.d/zabbix-server) inserted new line after the line 41 and added sleep 10

                Old (not working):
                log_daemon_msg "Starting $DESC" "$NAME"
                start-stop-daemon --oknodo --start --pidfile $PID \

                New (working):
                log_daemon_msg "Starting $DESC" "$NAME"
                sleep 10
                start-stop-daemon --oknodo --start --pidfile $PID \

                Comment

                • llucca
                  Junior Member
                  • May 2016
                  • 4

                  #9
                  same problem here, adding sleep 10 resolve the problem
                  Thank you

                  Comment

                  • kloczek
                    Senior Member
                    • Jun 2006
                    • 1771

                    #10
                    Originally posted by llucca
                    same problem here, adding sleep 10 resolve the problem
                    Thank you
                    If Zabbix server process writes to the logs that it is not possible to connect to database backend you need to check is you mysqld is running and if after reboot such things happens every time it means that mysql DB service is not marked as service which should be started on boot.
                    http://uk.linkedin.com/pub/tomasz-k%...zko/6/940/430/
                    https://kloczek.wordpress.com/
                    zapish - Zabbix API SHell binding https://github.com/kloczek/zapish
                    My zabbix templates https://github.com/kloczek/zabbix-templates

                    Comment

                    • jlemes
                      Junior Member
                      • Dec 2013
                      • 15

                      #11
                      I tried sleep, didn't work

                      Originally posted by jirijanata

                      New (working):
                      log_daemon_msg "Starting $DESC" "$NAME"
                      sleep 10
                      start-stop-daemon --oknodo --start --pidfile $PID \
                      I tried put 'sleep' in init.d script, and run again update-rc.d, but didn't work.

                      Any ideas?

                      Comment

                      • kljl43
                        Junior Member
                        • Apr 2014
                        • 5

                        #12
                        For me the answer was here:


                        ubuntu 16.04 uses systemd instead of upstart here and need to run these two commands:
                        Code:
                        systemctl enable zabbix-server
                        systemctl enable zabbix-agent

                        Comment

                        Working...