Ad Widget

Collapse

Zabbix server is running no after ubuntu restart

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • Fasih
    Junior Member
    • Aug 2022
    • 8

    #1

    Zabbix server is running no after ubuntu restart

    Hi guys, recently I downloaded zabbix 6.0 on ubuntu 20.04 as my hyper-v VM(My Server)...soo in start it works fine.
    I configure auto shutdown server at night and auto start in the morning...so the issue is that whenever my server goes up...my zabbix server says running no msg....but when I turn back and apply checkpoint to my VM it works normal...
    Here is my log

    1458:20220804:113959.616 database is down: reconnecting in 10 seconds
    1458:20220804:114009.616 [Z3001] connection to database 'zabbix' failed: [0] could not connect to server: Connection refused
    Is the server running on host "localhost" (127.0.0.1) and accepting
    TCP/IP connections on port 5432?

    Kindly please help me because my all network monitoring is stop from 2 days.
    Thank you.
    Last edited by Fasih; 04-08-2022, 10:36.
  • vladimir_lv
    Senior Member
    • May 2022
    • 240

    #2
    database is down: reconnecting in 10 seconds
    Does your database start after reboot?

    Comment

    • vladimir_lv
      Senior Member
      • May 2022
      • 240

      #3
      Probably, I know what was going wrong.
      1. Stop the Zabbix server.
      2. Stop the MySQL server.
      3. Start MsSQL server.
      4. Start the Zabbix server.
      The problem is in the order of process running, the Zabbix server always must start after DB starts.
      Check parameters After in zabbix-server.service. Is your database present there?

      Comment

      • Fasih
        Junior Member
        • Aug 2022
        • 8

        #4
        Yes I checked it my database is running after reboot.
        I stop and start the servers as you defined.
        My zabbix-server.service parameters are:

        [Unit]
        Description=Zabbix Server
        After=syslog.target
        After=network.target
        After=mysql.service

        [Service]
        Environment="CONFFILE=/etc/zabbix/zabbix_server.conf"
        EnvironmentFile=-/etc/default/zabbix-server
        Type=forking
        Restart=on-failure
        PIDFile=/run/zabbix/zabbix_server.pid
        KillMode=control-group
        ExecStart=/usr/sbin/zabbix_server -c $CONFFILE
        ExecStop=/bin/sh -c '[ -n "$1" ] && kill -s TERM "$1"' -- "$MAINPID"
        RestartSec=10s
        TimeoutSec=infinity

        [Install]
        WantedBy=multi-user.target


        Comment

        • vladimir_lv
          Senior Member
          • May 2022
          • 240

          #5
          Check what you have in the system: mysql.service or mysqld.service? Everything works now?

          Comment

          • Fasih
            Junior Member
            • Aug 2022
            • 8

            #6
            I think it is mysql.service.
            check this image.

            Click image for larger version

Name:	Capture.jpg
Views:	6806
Size:	166.8 KB
ID:	449315
            Attached Files

            Comment


            • vladimir_lv
              vladimir_lv commented
              Editing a comment
              Yes, it is mysql.service.
          • Fasih
            Junior Member
            • Aug 2022
            • 8

            #7
            Ok...but still my zabbix server is not running.
            Please paste the commands here as well so that i can run it on my ubuntu terminal.
            So much thankful to you as you are replying and giving me your precious time.

            Comment

            • vladimir_lv
              Senior Member
              • May 2022
              • 240

              #8
              Stop services
              Code:
              systemctl stop zabbix-server.service
              systemctl stop mysql.service
              Check if the services not running:
              Code:
              ps aux | grep -e mysql -e zabbix
              Start MySQL service
              Code:
              systemctl stop zabbix-server.service
              Check if the MySQL service is running:
              Code:
              ps aux | grep mysql
              Start Zabbix service
              Code:
              systemctl start zabbix-server.service

              Comment

              • Fasih
                Junior Member
                • Aug 2022
                • 8

                #9
                Yes I try these but still same issue.

                Comment

                • vladimir_lv
                  Senior Member
                  • May 2022
                  • 240

                  #10
                  Are you able to connect to database using your Zabbix credentials?
                  Code:
                  mysql -uzabbix -p zabbix

                  Comment


                  • Fasih
                    Fasih commented
                    Editing a comment
                    Yes I am connecting to database

                  • vladimir_lv
                    vladimir_lv commented
                    Editing a comment
                    Can you share zabbix_server.log?
                • xrzxq
                  Junior Member
                  • Mar 2021
                  • 2

                  #11
                  6736:20220805:042623.973 database is down: reconnecting in 10 seconds
                  6736:20220805:042633.973 [Z3001] connection to database 'zabbix' failed: [2002] Can't connect to local MySQL server through socket '/var/lib/mysql/mysql.sock' (2)
                  6736:20220805:042633.974 database is down: reconnecting in 10 seconds
                  6736:20220805:042643.974 [Z3001] connection to database 'zabbix' failed: [2002] Can't connect to local MySQL server through socket '/var/lib/mysql/mysql.sock' (2)
                  6736:20220805:042643.974 database is down: reconnecting in 10 seconds
                  6736:20220805:042653.974 [Z3001] connection to database 'zabbix' failed: [2002] Can't connect to local MySQL server through socket '/var/lib/mysql/mysql.sock' (2)
                  6736:20220805:042653.974 database is down: reconnecting in 10 seconds
                  6736:20220805:042703.974 [Z3001] connection to database 'zabbix' failed: [2002] Can't connect to local MySQL server through socket '/var/lib/mysql/mysql.sock' (2)
                  6736:20220805:042703.974 database is down: reconnecting in 10 seconds
                  6736:20220805:042713.974 [Z3001] connection to database 'zabbix' failed: [2002] Can't connect to local MySQL server through socket '/var/lib/mysql/mysql.sock' (2)
                  6736:20220805:042713.974 database is down: reconnecting in 10 seconds
                  6736:20220805:042723.975 [Z3001] connection to database 'zabbix' failed: [2002] Can't connect to local MySQL server through socket '/var/lib/mysql/mysql.sock' (2)
                  6736:20220805:042723.975 database is down: reconnecting in 10 seconds
                  6736:20220805:042733.975 [Z3001] connection to database 'zabbix' failed: [2002] Can't connect to local MySQL server through socket '/var/lib/mysql/mysql.sock' (2)
                  6736:20220805:042733.975 database is down: reconnecting in 10 seconds
                  6736:20220805:042743.975 [Z3001] connection to database 'zabbix' failed: [2002] Can't connect to local MySQL server through socket '/var/lib/mysql/mysql.sock' (2)
                  6736:20220805:042743.975 database is down: reconnecting in 10 seconds
                  6736:20220805:042753.975 [Z3001] connection to database 'zabbix' failed: [2002] Can't connect to local MySQL server through socket '/var/lib/mysql/mysql.sock' (2)
                  6736:20220805:042753.975 database is down: reconnecting in 10 seconds


                  [root@localhost zabbix]# netstat -lnp
                  Active Internet connections (only servers)
                  Proto Recv-Q Send-Q Local Address Foreign Address State PID/Program name
                  tcp 0 0 0.0.0.0:10050 0.0.0.0:* LISTEN 6258/zabbix_agentd
                  tcp 0 0 0.0.0.0:80 0.0.0.0:* LISTEN 6253/nginx: master
                  tcp 0 0 0.0.0.0:22 0.0.0.0:* LISTEN 1091/sshd
                  tcp6 0 0 :::10050 :::* LISTEN 6258/zabbix_agentd
                  tcp6 0 0 :::33060 :::* LISTEN 6643/mysqld
                  tcp6 0 0 :::3306 :::* LISTEN 6643/mysqld
                  tcp6 0 0 :::80 :::* LISTEN 6253/nginx: master
                  tcp6 0 0 :::22 :::* LISTEN 1091/sshd
                  udp 0 0 127.0.0.1:323 0.0.0.0:* 995/chronyd
                  udp6 0 0 ::1:323 :::* 995/chronyd
                  raw6 0 0 :::58 :::* 7 1074/NetworkManager
                  Active UNIX domain sockets (only servers)
                  Proto RefCnt Flags Type State I-Node PID/Program name Path
                  unix 2 [ ACC ] STREAM LISTENING 23517 1060/sssd_nss /var/lib/sss/pipes/nss
                  unix 2 [ ACC ] STREAM LISTENING 27692 1703/systemd /run/user/1000/systemd/private
                  unix 2 [ ACC ] STREAM LISTENING 55596 6463/php-fpm: maste /run/php-fpm/www.sock
                  unix 2 [ ACC ] STREAM LISTENING 55599 6463/php-fpm: maste /run/php-fpm/zabbix.sock
                  unix 2 [ ACC ] SEQPACKET LISTENING 20019 1/systemd /run/systemd/coredump
                  unix 2 [ ACC ] STREAM LISTENING 27701 1703/systemd /run/user/1000/bus
                  unix 2 [ ACC ] STREAM LISTENING 11848 1/systemd /run/systemd/journal/stdout
                  unix 2 [ ACC ] STREAM LISTENING 23412 983/sssd /var/lib/sss/pipes/private/sbus-monitor
                  unix 2 [ ACC ] STREAM LISTENING 23434 1058/sssd_be /var/lib/sss/pipes/private/sbus-dp_implicit_files.1058
                  unix 2 [ ACC ] STREAM LISTENING 59785 6643/mysqld /var/lib/mysql/mysqlx.sock
                  unix 2 [ ACC ] STREAM LISTENING 60272 6736/zabbix_server /run/zabbix/zabbix_server_rtc.sock
                  unix 2 [ ACC ] STREAM LISTENING 22384 1/systemd /var/run/.heim_org.h5l.kcm-socket
                  unix 2 [ ACC ] STREAM LISTENING 22386 1/systemd /run/dbus/system_bus_socket
                  unix 2 [ ACC ] STREAM LISTENING 19578 1/systemd /run/systemd/private
                  unix 2 [ ACC ] STREAM LISTENING 59801 6643/mysqld /data/mysql/mysql.sock
                  unix 2 [ ACC ] SEQPACKET LISTENING 19632 1/systemd /run/udev/control
                  unix 2 [ ACC ] STREAM LISTENING 23233 980/VGAuthService /var/run/vmware/guestServicePipe
                  unix 2 [ ACC ] STREAM LISTENING 19686 1/systemd /run/lvm/lvmpolld.socket
                  Active Bluetooth connections (only servers)
                  Proto Destination Source State PSM DCID SCID IMTU OMTU Security
                  Proto Destination Source State Channel

                  Log above, I found a problem, after the Zabbix-server started, there is no port number. Then, there is a SOCK communication in ZABBIX-SERVER_RTC.SOCK

                  Comment

                  • Fasih
                    Junior Member
                    • Aug 2022
                    • 8

                    #12
                    root@ubuntu-zabbix:/home/zabbix# tail /var/log/zabbix/zabbix_server.log
                    1142:20220805:144216.373 [Z3001] connection to database 'zabbix' failed: [0] could not connect to server: Connection refused
                    Is the server running on host "localhost" (127.0.0.1) and accepting
                    TCP/IP connections on port 5432?

                    1142:20220805:144216.373 database is down: reconnecting in 10 seconds
                    1142:20220805:144226.373 [Z3001] connection to database 'zabbix' failed: [0] could not connect to server: Connection refused
                    Is the server running on host "localhost" (127.0.0.1) and accepting
                    TCP/IP connections on port 5432?

                    1142:20220805:144226.373 database is down: reconnecting in 10 seconds

                    Comment

                    • DaLoZ
                      Junior Member
                      • Aug 2022
                      • 25

                      #13
                      Can you check if selinux is enabled?

                      Code:
                      sudo getenforce
                      and if so disable it and test again?

                      Code:
                      sudo setenfore 0
                      This setting resets itself after a reboot.

                      Comment


                      • Fasih
                        Fasih commented
                        Editing a comment
                        yeah it is disabled already....but still I am unable to resolve it
                    Working...