Ad Widget

Collapse

Strange issue

Collapse
This topic has been answered.
X
X
 
  • Time
  • Show
Clear All
new posts
  • philou31
    Junior Member
    • Jul 2024
    • 23

    #16
    I've made a "flush hosts" on my MariaDB (SQL command line) after observing same issue with a bash script making DB request. This action solved my issue for the script but not for Zabbix: user "zabbix"@"serverC" doesn't work but user "zabbix"@"%" works. I would rather have "zabbix"@"serverC".

    I noticed something in zabbix-server log: ==> cannot send list of active checks to "IP_SERVERC": host [SERVERB] not found
    And this for 2 servers whose hostname I changed.
    The new hostname for these 2 servers have been modified on Zabbix interface, checks are available without issue for days.

    And when I have a look a the discovery result on Zabbix interface I can notice that these 2 severs are the only ones whitout their hostname ==> IP_SERVER (hostname) while the others have it.

    So I really think it's a Zabbix issue, like cache or others (I sought everywhere in zabbix DB and I've not found anything with old servers name, only current servers name).

    (I've created a DNS server on a VM for having a specific DNS and not my internet box. All my servers and my NAS actually use this DNS instead of my internet box. All works, locally or other.)

    Comment

    • Markku
      Senior Member
      Zabbix Certified SpecialistZabbix Certified ProfessionalZabbix Certified Expert
      • Sep 2018
      • 1782

      #17
      Host IP configurations and agent hostname configurations inside Zabbix are not related to the DNS resolution happening inside the database service.

      Good that you already found something that affected the DNS resolution on the database.

      If you need further help, please lay out the exact and related current configurations and the error message information, maybe someone is able to help you further.

      Also, now that you noticed some pecularities in the database DNS resolution, you could try the "zabbix@%" case again and then see the host cache, what does the database tell you about the resolved name. See: https://mariadb.com/kb/en/performanc...t_cache-table/

      Markku

      Comment

      • Markku
        Senior Member
        Zabbix Certified SpecialistZabbix Certified ProfessionalZabbix Certified Expert
        • Sep 2018
        • 1782

        #18
        One more thing: What was your own explanation, why didn't the "zabbix"@"ip-of-the-zabbix-server" permission case work when you tested it?

        Markku

        Comment

        • philou31
          Junior Member
          • Jul 2024
          • 23

          #19
          The table "host_cache" is empty (following your link).
          User "zabbix"@"ip-of-the-zabbix-server" doesn't work, like "zabbix"@"hostname-of-the-zabbix-server".

          Comment

          • Markku
            Senior Member
            Zabbix Certified SpecialistZabbix Certified ProfessionalZabbix Certified Expert
            • Sep 2018
            • 1782

            #20
            Did you enable the performance schema? It is not enabled by default.

            Yes you told that the IP address syntax didn't work, but did you find out why your database server doesn't accept your Zabbix server's IP address in the permissions? You haven't showed us any configurations so we are not seeing your attempts or any typos or other reasons for the otherwise correct configurations to not work in your setup.

            Markku

            Comment

            • philou31
              Junior Member
              • Jul 2024
              • 23

              #21
              I have enable performance schema right now (it wasn't enabled).
              And I see good relation with (good) hostname-zabbix-server and ip-zabbix-server on table "host_cache". And for all others servers.

              What do you want to see as configuration?

              Comment

              • Markku
                Senior Member
                Zabbix Certified SpecialistZabbix Certified ProfessionalZabbix Certified Expert
                • Sep 2018
                • 1782

                #22
                Originally posted by philou31
                And I see good relation with (good) hostname-zabbix-server and ip-zabbix-server on table "host_cache". And for all others servers.
                Again you don't show us anything, you just say that everything is fine So, when you now give the Zabbix database user permissions based on the hostname that you see in the MariaDB host_cache (also removing all other Zabbix user permissions), is it working?

                Originally posted by philou31
                What do you want to see as configuration?
                - Zabbix server+frontend IP address+netmask and OS hostname
                - Zabbix server configurations (like sudo grep -v -E "^(#|$)" /etc/zabbix/zabbix_server.conf)
                - Zabbix frontend configurations (like sudo grep \$DB /etc/zabbix/web/zabbix.conf.php)
                - MariaDB server IP address+netmask and DNS resolver address(es)
                - select * from mysql.db where user="zabbix"\G (assuming your Zabbix database username is "zabbix")
                - /etc/hosts on the MariaDB server
                - Reverse DNS resolution results for Zabbix server+frontend IP addresses using the DNS resolver(s)
                - Information about how the DNS server/resolver is configured to know the IP+hostname mappings about the servers
                - what else do you think we should know?

                Plus, if you still have problems, I now third time ask you to provide the actual error messages with proper contexts (not just "I got error again" but what/where/how).

                (you can obviously replace sensitive information with some other unique descriptive strings, like replace IP addresses with private IP addresses, keeping the netmasks to be able to see which hosts are in the same subnet and which are not)

                Markku
                Last edited by Markku; 21-07-2024, 18:44.

                Comment

                • philou31
                  Junior Member
                  • Jul 2024
                  • 23

                  #23
                  Originally posted by Markku
                  Again you don't show us anything, you just say that everything is fine
                  Screenshot of host_cache table:
                  Click image for larger version

Name:	Capture d’écran du 2024-07-22 18-16-41.png
Views:	128
Size:	38.3 KB
ID:	488115
                  Zabbix server name is fr-srvmonitor.

                  Originally posted by Markku
                  So, when you now give the Zabbix database user permissions based on the hostname that you see in the MariaDB host_cache (also removing all other Zabbix user permissions), is it working?
                  No it's not working because it's exactly what I've done in previous tests.

                  Originally posted by Markku
                  - Zabbix server+frontend IP address+netmask and OS hostname
                  Click image for larger version

Name:	Capture d’écran du 2024-07-22 18-18-16.png
Views:	84
Size:	27.0 KB
ID:	488116

                  Originally posted by Markku
                  - Zabbix server configurations (like sudo grep -v -E "^(#|$)" /etc/zabbix/zabbix_server.conf)
                  LogFile=/var/log/zabbix/zabbix_server.log
                  LogFileSize=0
                  PidFile=/run/zabbix/zabbix_server.pid
                  SocketDir=/run/zabbix
                  DBHost=DBSERV
                  DBName=zabbix
                  DBUser=zabbix
                  DBPassword=ABCDEF
                  DBPort=3307
                  AllowUnsupportedDBVersions=1
                  SNMPTrapperFile=/var/log/snmptrap/snmptrap.log
                  Timeout=4
                  AlertScriptsPath=/usr/lib/zabbix/alertscripts
                  FpingLocation=/usr/bin/fping
                  Fping6Location=/usr/bin/fping6
                  LogSlowQueries=3000
                  User=chkuser
                  StatsAllowedIP=127.0.0.1

                  Originally posted by Markku
                  - MariaDB server IP address+netmask and DNS resolver address(es)
                  Click image for larger version

Name:	Capture d’écran du 2024-07-22 18-21-22.png
Views:	75
Size:	14.2 KB
ID:	488117
                  Click image for larger version

Name:	Capture d’écran du 2024-07-22 18-21-54.png
Views:	82
Size:	34.5 KB
ID:	488118


                  Originally posted by Markku
                  - select * from mysql.db where user="zabbix"\G (assuming your Zabbix database username is "zabbix")
                  Click image for larger version

Name:	Capture d’écran du 2024-07-22 18-22-53.png
Views:	75
Size:	35.1 KB
ID:	488119
                  Last edited by philou31; 23-07-2024, 17:30.

                  Comment


                  • Markku
                    Markku commented
                    Editing a comment
                    I don't see any pictures in the post, even though I see the pictures in other posts, can you maybe try pasting/attaching them somehow differently? (can be a bug in the forum software or something)

                  • Markku
                    Markku commented
                    Editing a comment
                    After your latest edit I now see the pictures in this post, but not in the later post.
                • Markku
                  Senior Member
                  Zabbix Certified SpecialistZabbix Certified ProfessionalZabbix Certified Expert
                  • Sep 2018
                  • 1782

                  #24
                  AllowUnsupportedDBVersions=1
                  Is there some specific reason for this?

                  Markku

                  Comment

                  • Markku
                    Senior Member
                    Zabbix Certified SpecialistZabbix Certified ProfessionalZabbix Certified Expert
                    • Sep 2018
                    • 1782

                    #25
                    modifying user "zabbix"@"%" to "zabbix"@"fr-srvmonitor"
                    If your DNS resolver returns the server name as an FQDN (bind usually does, but as mentioned, I don't see your images in the post), this server name "fr-srvmonitor" (without domain) won't work, based on the MySQL/MariaDB documentation. Unless of course there is a hosts file entry on the DB server for it.

                    Markku

                    Comment

                    • philou31
                      Junior Member
                      • Jul 2024
                      • 23

                      #26
                      I've tried to copy/paste screenshots but I should cut my post in 2 posts.
                      2nd post:
                      Originally posted by Markku
                      - /etc/hosts on the MariaDB server


                      Originally posted by Markku
                      - Reverse DNS resolution results for Zabbix server+frontend IP addresses using the DNS resolver(s)


                      Originally posted by Markku
                      - Information about how the DNS server/resolver is configured to know the IP+hostname mappings about the servers
                      Using bind.
                      With 1 zone named "maison" with all servers & IP on it:

                      And another zone for reverse:


                      Originally posted by Markku
                      - what else do you think we should know?
                      Originally posted by Markku
                      Plus, if you still have problems, I now third time ask you to provide the actual error messages with proper contexts (not just "I got error again" but what/where/how).

                      (you can obviously replace sensitive information with some other unique descriptive strings, like replace IP addresses with private IP addresses, keeping the netmasks to be able to see which hosts are in the same subnet and which are not)

                      Markku
                      Here is the error message after modifying user "zabbix"@"%" to "zabbix"@"fr-srvmonitor" (action on zabbix interface is just to modify DNS name on the server):

                      Hostname "fr-srvsurv" was the old name of zabbix server, before become "fr-srvmonitor".​


                      I hope you can see them now.

                      AllowUnsupportedDBVersions=1
                      Originally posted by Markku

                      Is there some specific reason for this?

                      Markku
                      No particular reason, I've seen this on an installation procedure.
                      Last edited by philou31; 23-07-2024, 17:31.

                      Comment


                      • Markku
                        Markku commented
                        Editing a comment
                        No pictures yet in this post
                    • philou31
                      Junior Member
                      • Jul 2024
                      • 23

                      #27

                      A big bug on the forum...

                      I try to answer you with text instead of pictures...

                      Content of host_cache table:
                      Code:
                      IP                     HOST                     HOST_VALIDATED
                      192.168.1.150      fr-srvweb           YES
                      192.168.1.160      fr-srvmail           YES
                      192.168.1.180      fr-srvmonitor      YES
                      192.168.1.170      fr-srvcomm        YES
                      192.168.1.140      fr-srvbackups     YES
                      192.168.1.190      fr-srvtest            YES
                      ==> All my servers

                      - Zabbix server+frontend IP address+netmask and OS hostname
                      Code:
                      eth0: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qdisc pfifo_fast state UP group default qlen 1000
                      link/ether b8:27:eb:75:85:ad brd ff:ff:ff:ff:ff:ff
                      inet 192.168.1.180/24 brd 192.168.1.255 scope global dynamic noprefixroute eth0
                      valid_lft 21905sec preferred_lft 21905sec
                      Hostname: fr-srvmonitor

                      - Zabbix frontend configurations (like sudo grep \$DB /etc/zabbix/web/zabbix.conf.php)
                      Code:
                      $DB['TYPE'] = 'MYSQL';
                      $DB['SERVER'] = 'DBSERV';
                      $DB['PORT'] = '3307';
                      $DB['DATABASE'] = 'zabbix';
                      $DB['USER'] = 'zabbix';
                      $DB['PASSWORD'] = 'ABCDEF';
                      $DB['SCHEMA'] = '';
                      $DB['ENCRYPTION'] = false;
                      $DB['KEY_FILE'] = '';
                      $DB['CERT_FILE'] = '';
                      $DB['CA_FILE'] = '';
                      $DB['VERIFY_HOST'] = false;
                      $DB['CIPHER_LIST'] = '';
                      $DB['VAULT'] = '';
                      $DB['VAULT_URL'] = '';
                      $DB['VAULT_PREFIX'] = '';
                      $DB['VAULT_DB_PATH'] = '';
                      $DB['VAULT_TOKEN'] = '';
                      $DB['VAULT_CERT_FILE'] = '';
                      $DB['VAULT_KEY_FILE'] = '';
                      // $DB['VAULT_CACHE'] = true;​
                      - MariaDB server IP address+netmask and DNS resolver address(es)
                      Code:
                      IP : 192.168.1.166
                      Netmask : 255.255.255.0
                      Gateway : 192.168.1.254
                      DNS : 192.168.1.5
                      - select * from mysql.db where user="zabbix"\G (assuming your Zabbix database username is "zabbix")
                      Code:
                      Result:
                      - Host: %
                      - Db: zabbix
                      - User: zabbix
                      - /etc/hosts on the MariaDB server
                      Code:
                      127.0.0.1 localhost
                      ::1 localhost
                      127.0.0.1 fr-nassyno
                      ::1 fr-nassyno
                      
                      192.168.1.160 fr-srvmail srvmail
                      192.168.1.170 fr-srvcomm srvcomm
                      192.168.1.166 fr-nassyno DBSERV
                      192.168.1.167 fr-nassyno-nfs
                      192.168.1.190 fr-srvtest srvtest
                      192.168.1.180 fr-srvmonitor srvmonitor
                      192.168.1.150 fr-srvweb srvweb
                      192.168.1.81 ubu-phil phil-games
                      192.168.1.120 fr-srvansible srvansible
                      192.168.1.140 fr-srvbackups srvbackups
                      192.168.1.5 fr-srvDNS srvDNS​
                      - Reverse DNS resolution results for Zabbix server+frontend IP addresses using the DNS resolver(s)
                      Code:
                      ash-4.4# nslookup 192.168.1.180
                      180.1.168.192.in-addr.arpa name = fr-srvmonitor.
                      Code:
                      ash-4.4# nslookup fr-srvmonitor
                      Server: 192.168.1.5
                      Address: 192.168.1.5#53
                      
                      Name: fr-srvmonitor.maison
                      Address: 192.168.1.180​
                      - Information about how the DNS server/resolver is configured to know the IP+hostname mappings about the servers
                      Using bind.
                      With 1 zone named "maison" with all servers & IP on it:​
                      Code:
                      $TTL 10800
                      $ORIGIN maison.
                      @ IN SOA fr-srvDNS.maison. root.maison. (
                      20180906;
                      3h;
                      1h;
                      1w;
                      1h);
                      @ IN NS fr-srvDNS.maison.
                      host IN A 192.168.1.1
                      fr-srvDNS IN A 192.168.1.5
                      fr-srvtest IN A 192.168.1.190
                      fr-srvmail IN A 192.168.1.160
                      fr-srvcomm IN A 192.168.1.170
                      fr-srvmonitor IN A 192.168.1.180
                      fr-srvbackups IN A 192.168.1.140
                      fr-srvweb IN A 192.168.1.150
                      fr-nassyno IN A 192.168.1.166
                      fr-nassyno-nfs IN A 192.168.1.167​
                      And another zone for reverse:
                      Code:
                      $TTL 10800
                      $ORIGIN 1.168.192.in-addr.arpa.
                      @ IN SOA fr-srvDNS.maison. root.maison. (
                      20180906;
                      3h;
                      1h;
                      1w;
                      1h);
                      @ IN NS fr-srvDNS.maison.
                      1 IN PTR host.maison.
                      5 IN PTR fr-srvDNS.
                      190 IN PTR fr-srvtest.
                      160 IN PTR fr-srvmail.
                      170 IN PTR fr-srvcomm.
                      180 IN PTR fr-srvmonitor.
                      140 IN PTR fr-srvbackups.
                      150 IN PTR fr-srvweb.
                      166 IN PTR fr-nassyno.
                      167 IN PTR fr-nassyno-nfs.​

                      Comment

                      • philou31
                        Junior Member
                        • Jul 2024
                        • 23

                        #28
                        Here is the error message after modifying user "zabbix"@"%" to "zabbix"@"fr-srvmonitor" (action on zabbix interface is just to modify DNS name on the server):
                        Code:
                        Error in query [UPDATE hosts SET host='fr-srvtest',name='fr-srvtest',monitored_by='0',status='1',tls_connect='1',tls_accept='1',tls_psk_identity='',tls_psk='',tls_issuer='',tls_subject='',proxyid=NULL,proxy_groupid=NULL WHERE hostid='10527'] [The user specified as a definer ('zabbix'@'fr-srvsurv') does not exist] [zabbix.php:17 → require_once() → ZBase->run() → ZBase->processRequest() → CController->run() → CControllerHostUpdate->doAction() → CApiWrapper->__call() → CFrontendApiWrapper->callMethod() → CApiWrapper->callMethod() → CFrontendApiWrapper->callClientMethod() → CLocalApiClient->callMethod() → CHost->update() → CHost->updateForce() → CHost->massUpdate() → DB::update() → DBexecute() → trigger_error() in include/db.inc.php:362]
                        L'exécution de l'instruction SQL a échoué"UPDATE hosts SET host='fr-srvtest',name='fr-srvtest',monitored_by='0',status='1',tls_connect='1',tls_accept='1',tls_psk_identity='',tls_psk='',tls_issuer='',tls_subject='',proxyid=NULL,proxy_groupid=NULL WHERE hostid='10527'".
                        Hostname "fr-srvsurv" was the old name of zabbix server, before become "fr-srvmonitor".

                        Comment

                        • Markku
                          Senior Member
                          Zabbix Certified SpecialistZabbix Certified ProfessionalZabbix Certified Expert
                          • Sep 2018
                          • 1782

                          #29
                          (Written before seeing your previous post)

                          Thanks for the information. The DNS configuration is a bit atypical (reverse zone returns non-FQDN records, and NAS has /etc/hosts for the relevant IPs), but apparently MariaDB is still happy with the resolutions, based on the host_cache table.

                          Now, is it still so that if you configure the Zabbix database permissions for "zabbix"@"fr-srvmonitor" (and drop all other "zabbix" permissions), flush privileges just to be sure, MariaDB rejects connections from Zabbix server? And also, if you configure permissions for "zabbix"@"192.168.1.180", the same thing? What host the host_cache table say at the same time? ("flush hosts" maybe useful before)

                          Markku

                          Comment

                          • philou31
                            Junior Member
                            • Jul 2024
                            • 23

                            #30
                            First test:
                            only "zabbix"@"fr-srvmonitor", flush privileges, flush hosts ==> host_cache: 192.168.1.180 fr-srvmonitor YES

                            Second test:
                            only "zabbix"@"192.168.1.180", flush privileges, flush hosts ==> host_cache: 192.168.1.180 fr-srvmonitor YES

                            Rejected connections for both.

                            Comment

                            Working...