Ad Widget

Collapse

Lates Zabbix and CentOS 7.2

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • andrewm659
    Junior Member
    • Mar 2006
    • 17

    #1

    Lates Zabbix and CentOS 7.2

    I have Zabbix running on a my CentOS install. I was able to configure it with remote MySQL/MariaDB but i'm getting this in the logs.

    21673:20151228:215724.611 [Z3001] connection to database 'zabbix' failed: [2002] Can't connect to local MySQL server through socket '/var/lib/mysql/mysql.sock' (2)
    21673:20151228:215724.611 database is down: reconnecting in 10 seconds
    21673:20151228:215734.611 [Z3001] connection to database 'zabbix' failed: [2002] Can't connect to local MySQL server through socket '/var/lib/mysql/mysql.sock' (2)
    21673:20151228:215734.611 database is down: reconnecting in 10 seconds
    21673:20151228:215744.611 [Z3001] connection to database 'zabbix' failed: [2002] Can't connect to local MySQL server through socket '/var/lib/mysql/mysql.sock' (2)
    21673:20151228:215744.611 database is down: reconnecting in 10 seconds
    21673:20151228:215754.612 [Z3001] connection to database 'zabbix' failed: [2002] Can't connect to local MySQL server through socket '/var/lib/mysql/mysql.sock' (2)
    21673:20151228:215754.612 database is down: reconnecting in 10 seconds
    [user@asm-zabbix01 ~]$

    sudo netstat -tunlp
    Active Internet connections (only servers)
    Proto Recv-Q Send-Q Local Address Foreign Address State PID/Program name
    tcp 0 0 192.168.122.1:53 0.0.0.0:* LISTEN 4845/dnsmasq
    tcp 0 0 0.0.0.0:22 0.0.0.0:* LISTEN 1590/sshd
    tcp 0 0 127.0.0.1:631 0.0.0.0:* LISTEN 1592/cupsd
    tcp 0 0 127.0.0.1:25 0.0.0.0:* LISTEN 2764/master
    tcp 0 0 0.0.0.0:10050 0.0.0.0:* LISTEN 16202/zabbix_agentd
    tcp6 0 0 :::80 :::* LISTEN 1606/httpd
    tcp6 0 0 :::22 :::* LISTEN 1590/sshd
    tcp6 0 0 ::1:631 :::* LISTEN 1592/cupsd
    tcp6 0 0 ::1:25 :::* LISTEN 2764/master
    tcp6 0 0 :::10050 :::* LISTEN 16202/zabbix_agentd
    udp 0 0 192.168.122.1:53 0.0.0.0:* 4845/dnsmasq
    udp 0 0 0.0.0.0:67 0.0.0.0:* 4845/dnsmasq
    udp 0 0 0.0.0.0:56536 0.0.0.0:* 861/avahi-daemon: r
    udp 0 0 0.0.0.0:5353 0.0.0.0:* 861/avahi-daemon: r

    sudo getsebool -a|egrep "httpd_can_connect_zabbix|zabbix_can_network|httpd _can_network_connect|httpd_can_network_connect_db| httpd_can_network_relay"
    httpd_can_connect_zabbix --> on
    httpd_can_network_connect --> on
    httpd_can_network_connect_cobbler --> off
    httpd_can_network_connect_db --> on
    httpd_can_network_relay --> on
    zabbix_can_network --> on

    sudo firewall-cmd --zone=public --list-all
    public (default, active)
    interfaces: ens160
    sources:
    services: dhcpv6-client http https ssh
    ports:
    masquerade: no
    forward-ports:
    icmp-blocks:
    rich rules:


    [user@asm-zabbix01 ~]$ mysql -h 10.150.1.80 -u zabbix -D zabbix -p
    Enter password:
    Reading table information for completion of table and column names
    You can turn off this feature to get a quicker startup with -A

    Welcome to the MariaDB monitor. Commands end with ; or \g.
    Your MariaDB connection id is 4186
    Server version: 5.5.44-MariaDB-log MariaDB Server

    Copyright (c) 2000, 2015, Oracle, MariaDB Corporation Ab and others.

    Type 'help;' or '\h' for help. Type '\c' to clear the current input statement.

    MariaDB [zabbix]> use zabbix
    Database changed
    MariaDB [zabbix]> show database
    -> show
    -> show tables;
    ERROR 1064 (42000): You have an error in your SQL syntax; check the manual that corresponds to your MariaDB server version for the right syntax to use near 'database
    show
    show tables' at line 1
    MariaDB [zabbix]> show databases;
    +------------------------+
    | Database |
    +------------------------+
    | information_schema |
    | clouddb |
    | mysql |
    | #mysql50#mysql-bin-log |
    | nedi |
    | netxms |
    | otrs2 |
    | performance_schema |
    | pydiodb |
    | rattic |
    | rattic2 |
    | test |
    | zabbix |
    +------------------------+
    13 rows in set (0.00 sec)

    MariaDB [zabbix]> \q
    Bye
    [user@asm-zabbix01 ~]$
  • ingus.vilnis
    Senior Member
    Zabbix Certified Trainer
    Zabbix Certified SpecialistZabbix Certified Professional
    • Mar 2014
    • 908

    #2
    Hi,

    What have you set for DBHost in zabbix_server.conf file?
    Are the credentials correct there?

    Best Regards,
    Ingus

    Comment

    • andrewm659
      Junior Member
      • Mar 2006
      • 17

      #3
      Originally posted by ingus.vilnis
      Hi,

      What have you set for DBHost in zabbix_server.conf file?
      Are the credentials correct there?

      Best Regards,
      Ingus
      [user@asm-zabbix01 ~]$ sudo cat /etc/zabbix/zabbix_server.conf |grep -i DBHost
      ### Option: DBHost
      # DBHost=localhost
      [user@asm-zabbix01 ~]$

      Comment

      • ingus.vilnis
        Senior Member
        Zabbix Certified Trainer
        Zabbix Certified SpecialistZabbix Certified Professional
        • Mar 2014
        • 908

        #4
        Originally posted by andrewm659
        I have Zabbix running on a my CentOS install. I was able to configure it with remote MySQL/MariaDB but i'm getting this in the logs.

        21673:20151228:215724.611 [Z3001] connection to database 'zabbix' failed: [2002] Can't connect to local MySQL server through socket '/var/lib/mysql/mysql.sock' (2)
        Set DBHost=10.150.1.80 (or what you have for that remote host) so that Zabbix connect to it otherwise it is attempting to find MySQL on the same machine.

        Best Regards,
        Ingus

        Comment

        • andrewm659
          Junior Member
          • Mar 2006
          • 17

          #5
          Originally posted by ingus.vilnis
          Set DBHost=10.150.1.80 (or what you have for that remote host) so that Zabbix connect to it otherwise it is attempting to find MySQL on the same machine.

          Best Regards,
          Ingus
          Still getting the "Zabbix server is not running: the information displayed may not be current"

          Zabbix server is running = NO in browser.

          Comment

          • ingus.vilnis
            Senior Member
            Zabbix Certified Trainer
            Zabbix Certified SpecialistZabbix Certified Professional
            • Mar 2014
            • 908

            #6
            1. Did you restart Zabbix server?
            2. Were you able to fix connection to database 'zabbix' failed errors?
            3. Is your web server located on the same host as Zabbix server?

            Comment

            • andrewm659
              Junior Member
              • Mar 2006
              • 17

              #7
              Originally posted by ingus.vilnis
              1. Did you restart Zabbix server?
              2. Were you able to fix connection to database 'zabbix' failed errors?
              3. Is your web server located on the same host as Zabbix server?
              1. Yes.
              2. No. Its still giving me problems.
              3. No, two separate hosts on the same LAN segment.

              I can ping it and connect to it using MySQL/MariaDB client.

              4019:20151229:094450.906 database is down: reconnecting in 10 seconds
              4019:20151229:094500.907 [Z3001] connection to database 'zabbix' failed: [1045] Access denied for user 'zabbix'@'asm-zabbix01.borg.local' (using password: NO)
              4019:20151229:094500.908 database is down: reconnecting in 10 seconds


              So maybe a permission problem...?

              Comment

              • ingus.vilnis
                Senior Member
                Zabbix Certified Trainer
                Zabbix Certified SpecialistZabbix Certified Professional
                • Mar 2014
                • 908

                #8
                1. Check DBUser and DBPassword in zabbix_server.conf

                2. Fix SERVER address and credentials in "/etc/zabbix/web/zabbix.conf.php"
                and ZBX_SERVER address as well

                Comment

                • andrewm659
                  Junior Member
                  • Mar 2006
                  • 17

                  #9
                  Originally posted by ingus.vilnis
                  1. Check DBUser and DBPassword in zabbix_server.conf

                  2. Fix SERVER address and credentials in "/etc/zabbix/web/zabbix.conf.php"
                  and ZBX_SERVER address as well
                  Everything looks fine.

                  [root@asm-zabbix01 ~]# cat /etc/zabbix/web/zabbix.conf.php
                  <?php
                  // Zabbix GUI configuration file.
                  global $DB;

                  $DB['TYPE'] = 'MYSQL';
                  $DB['SERVER'] = '10.150.1.80';
                  $DB['PORT'] = '3306';
                  $DB['DATABASE'] = 'zabbix';
                  $DB['USER'] = 'zabbix';
                  $DB['PASSWORD'] = 'password';

                  // Schema name. Used for IBM DB2 and PostgreSQL.
                  $DB['SCHEMA'] = '';

                  $ZBX_SERVER = '10.150.1.69';
                  $ZBX_SERVER_PORT = '10051';
                  $ZBX_SERVER_NAME = 'zabbix01.borg.local';

                  $IMAGE_FORMAT_DEFAULT = IMAGE_FORMAT_PNG;
                  ?>
                  [root@asm-zabbix01 ~]#

                  Comment

                  • ingus.vilnis
                    Senior Member
                    Zabbix Certified Trainer
                    Zabbix Certified SpecialistZabbix Certified Professional
                    • Mar 2014
                    • 908

                    #10
                    So is it working now or not?

                    If still not working then check /var/log/audit on all servers, SELinux and IPtables.

                    Best Regards,
                    Ingus

                    Comment

                    • andrewm659
                      Junior Member
                      • Mar 2006
                      • 17

                      #11
                      Originally posted by ingus.vilnis
                      So is it working now or not?

                      If still not working then check /var/log/audit on all servers, SELinux and IPtables.

                      Best Regards,
                      Ingus
                      Sorry, no it is still giving me the same error at the top.

                      I appreciate all the help. I will start checking /var/log/audit again and IPTables/FirewallD.

                      Comment

                      • andrewm659
                        Junior Member
                        • Mar 2006
                        • 17

                        #12
                        Originally posted by andrewm659
                        Sorry, no it is still giving me the same error at the top.

                        I appreciate all the help. I will start checking /var/log/audit again and IPTables/FirewallD.
                        Fixed! Some configurations I missed.

                        Thank you!

                        Comment


                        • aasami
                          aasami commented
                          Editing a comment
                          "Fixed!" - How?
                          "Some configurations I missed." - Which ones?
                      • aib
                        Senior Member
                        • Jan 2014
                        • 1615

                        #13
                        I assume that he forgot to give a correct permission for user ZABBIX (without password) to access remote database.
                        connection to database 'zabbix' failed: [1045] Access denied for user 'zabbix'@'asm-zabbix01.borg.local' (using password: NO)
                        In that case he can connect to database using password, but zabbix front end will fail to connect without password.
                        Sincerely yours,
                        Aleksey

                        Comment

                        Working...