zabbix / zabbix-docker

Official Zabbix Dockerfiles
https://www.zabbix.com
GNU Affero General Public License v3.0
2.41k stars 1.39k forks source link

URL using bad/illegal format or missing URL #971

Closed marbman21 closed 2 years ago

marbman21 commented 2 years ago
SUMMARY

I am getting the error "URL using bad/illegal format or missing URL" when testing the email function and the same error is present when alerts are attempting to send. No alerts are actually sent. This started happening earlier this week when no changes were made on the server or on Zabbix. I tried a complete fresh install of Zabbix and still the error is there. No changes were made anywhere and the server was not even accessed during this past week.

OS / ENVIRONMENT / Used docker-compose files

Zabbix 6.0.5 Latest docker Zabbix images have been pulled and put into place. Ubuntu 20.04

CONFIGURATION
STEPS TO REPRODUCE

Install Zabbix, configure html email mediatype, attempt to send email using the test option.

dotneft commented 2 years ago

do you think such problem related to Zabbix or Zabbix docker images?

marbman21 commented 2 years ago

I am not sure to be honest. Although I can say that this happened on 2 different server at the same time using only the docker images. I have checked the Zabbix forums and did not find any recent posts related to this issue and any other posts with this error was related to Vmware which is not configured at all in our Zabbix and certainly not in this fresh install we just did this morning with only the email mediatype configured.

dotneft commented 2 years ago

Try to switch Zabbix server to debug and then check debug logs related to test notifications.

marbman21 commented 2 years ago

I have already done this and it does not provide much information. Here is what I find in the logs:

203:20220605:142755.503 In send_email() smtp_server:'storm.**.com' smtp_port:465 smtp_security:2 smtp_authentication:1 203:20220605:142755.503 * Closing connection -1 203:20220605:142755.503 failed to send email: URL using bad/illegal format or missing URL 203:20220605:142755.503 End of send_email():FAIL

** is just me hiding the domain.

From what I can find on the net, the error " URL using bad/illegal format or missing URL" seem to be related to curl. I have confirmed curl is up to date on the server.

dotneft commented 2 years ago

what image do you use? Could you check inside container:

curl -V
dotneft commented 2 years ago

I checked all Zabbix server images 6.0.5 (alpine, centos, ol, ubuntu). All of them support smtp / smtps protocol:

curl 7.61.1 (x86_64-redhat-linux-gnu) libcurl/7.61.1 OpenSSL/1.1.1k zlib/1.2.11 brotli/1.0.6 libidn2/2.2.0 libpsl/0.20.2 (+libidn2/2.2.0) libssh/0.9.6/openssl/zlib nghttp2/1.33.0
Release-Date: 2018-09-05
Protocols: dict file ftp ftps gopher http https imap imaps ldap ldaps pop3 pop3s rtsp scp sftp smb smbs smtp smtps telnet tftp 
Features: AsynchDNS IDN IPv6 Largefile GSS-API Kerberos SPNEGO NTLM NTLM_WB SSL libz brotli TLS-SRP HTTP2 UnixSockets HTTPS-proxy PSL 
marbman21 commented 2 years ago

I am using the ubuntu-latest image.

docker exec -it zabbix-web /bin/bash zabbix@86f7450036b3:/usr/share/zabbix$ curl -V curl 7.81.0 (x86_64-pc-linux-gnu) libcurl/7.81.0 OpenSSL/3.0.2 zlib/1.2.11 brotli/1.0.9 zstd/1.4.8 libidn2/2.3.2 libpsl/0.21.0 (+libidn2/2.3.2) libssh/0.9.6/openssl/zlib nghttp2/1.43.0 librtmp/2.3 OpenLDAP/2.5.11 Release-Date: 2022-01-05 Protocols: dict file ftp ftps gopher gophers http https imap imaps ldap ldaps mqtt pop3 pop3s rtmp rtsp scp sftp smb smbs smtp smtps telnet tftp Features: alt-svc AsynchDNS brotli GSS-API HSTS HTTP2 HTTPS-proxy IDN IPv6 Kerberos Largefile libz NTLM NTLM_WB PSL SPNEGO SSL TLS-SRP UnixSockets zstd

dotneft commented 2 years ago

I just checked both STARTTLS and SSL, everything works fine with ubuntu-6.0.5 version. Could you try to increase debug to 5 level?

   221:20220607:233634.558 In send_email() smtp_server:'smtp.office365.com' smtp_port:587 smtp_security:1 smtp_authentication:1
   221:20220607:233634.569 *   Trying 52.98.151.66:587...
   221:20220607:233634.588 * Connected to smtp.office365.com (52.98.151.66) port 587 (#0)
   221:20220607:233634.609 < 220 GV3P280CA0098.outlook.office365.com Microsoft ESMTP MAIL Service ready at Tue, 7 Jun 2022 20:36:34 +0000
   221:20220607:233634.609 > EHLO smtp.office365.com
   221:20220607:233634.629 < 250-GV3P280CA0098.outlook.office365.com Hello [87.110.165.38]
   221:20220607:233634.629 < 250-SIZE 157286400
   221:20220607:233634.629 < 250-PIPELINING
   221:20220607:233634.629 < 250-DSN
   221:20220607:233634.629 < 250-ENHANCEDSTATUSCODES
   221:20220607:233634.629 < 250-STARTTLS
   221:20220607:233634.629 < 250-8BITMIME
   221:20220607:233634.629 < 250-BINARYMIME
   221:20220607:233634.629 < 250-CHUNKING
   221:20220607:233634.629 < 250 SMTPUTF8
   221:20220607:233634.629 > STARTTLS
   221:20220607:233634.648 < 220 2.0.0 SMTP server ready
...

and

   222:20220607:233820.048 In send_email() smtp_server:'smtp.office365.com' smtp_port:587 smtp_security:2 smtp_authentication:1
  222:20220607:233820.060 *   Trying 52.98.151.82:587...
   222:20220607:233820.083 * Connected to smtp.office365.com (52.98.151.82) port 587 (#0)
   222:20220607:233820.138 *  CAfile: /etc/ssl/certs/ca-certificates.crt
   222:20220607:233820.138 *  CApath: /var/lib/zabbix/ssl/ssl_ca/
   222:20220607:233820.138 * TLSv1.0 (OUT), TLS header, Certificate Status (22):
   222:20220607:233820.138 * TLSv1.3 (OUT), TLS handshake, Client hello (1):
...
marbman21 commented 2 years ago

This was previously posted with log level 5. That is the only information provided.

203:20220605:142755.503 In send_email() smtp_server:'storm.**.com' smtp_port:465 smtp_security:2 smtp_authentication:1 203:20220605:142755.503 * Closing connection -1 203:20220605:142755.503 failed to send email: URL using bad/illegal format or missing URL 203:20220605:142755.503 End of send_email():FAIL

dotneft commented 2 years ago

I see, maybe you have some special characters there. Could you try to recreate the media type from scratch and do not copy paste?

marbman21 commented 2 years ago

I just did this with using a very simple password with no special characters (no copy/paste) and still no luck. I also tried over the last few days to use a different email account and that will not work either. Like I said this all started on its own with no configuration changes to Zabbix or the either of the servers that this is happening on. Neither zabbix or the server were even accessed last week when this began.

I am at a total loss of what could be causing this.

dotneft commented 2 years ago

Do you see any traffic between SMTP server and container's IP?

marbman21 commented 2 years ago

Not that I can see.

marbman21 commented 2 years ago

I have confirmed that other containers on one of the servers this is happening on, are able to send smtp emails with no issues. So that would rule out a server wide issue and point this more towards the zabbix container.

dotneft commented 2 years ago

I'm still thinking that you have specified something incorrect. Please attach media type configuration form screenshot.

marbman21 commented 2 years ago

Well I finally figured it out after hours upon hours of troubleshooting. I previously has "Zabbix Monitoring" under the SMTP Helo setting. It has worked just fine for years, but must not work with the newest version. Once I change this entry to the actual domain of the zabbix install, it worked just fine.

So I guess that is why 2 installs stopped working at the same time and was a misconfiguration from the start, but worked for a number of years and that is why it never crossed my mind.

Thanks for all your help and sorry for wasting so much of your time.