[ZBX-19894] Web check fails on IPv6 Created: 2021 Aug 31  Updated: 2024 Apr 10

Status: Elaborating
Project: ZABBIX BUGS AND ISSUES
Component/s: Proxy (P), Server (S)
Affects Version/s: 5.0.15
Fix Version/s: None

Type: Incident report Priority: Trivial
Reporter: Roy Sigurd Karlsbakk Assignee: Alex Kalimulin
Resolution: Unresolved Votes: 0
Labels: None
Remaining Estimate: Not Specified
Time Spent: Not Specified
Original Estimate: Not Specified
Environment:

Irrelevant


Team: Team A
Sprint: Roadmap Backlog

 Description   

Steps to reproduce:

  1. Create host with ipv6 address
  2. Choose connect to IP
  3. Add web check, such as Apache
  4. It fails with "Cannot perform request: IPv6 numerical address used in URL without brackets"

Result:
**
Cannot perform request: IPv6 numerical address used in URL without brackets
Expected:
Works



 Comments   
Comment by Igor Gorbach (Inactive) [ 2021 Sep 02 ]

Hello!

Have you tried to use brackets before and after ipv6 adress or {HOST.CONN} macro?

Comment by Roy Sigurd Karlsbakk [ 2021 Sep 02 ]

I've just added Template App Apache by HTTP to a host on IPv6. I haven't changed anything else.

Comment by Roy Sigurd Karlsbakk [ 2021 Sep 02 ]

In that template, there's an item doing the web check

{$APACHE.STATUS.SCHEME}://{HOST.CONN}:{$APACHE.STATUS.PORT}/{$APACHE.STATUS.PATH}

If I add [] around {HOST.CONN}, it should work with IPs, but it also should break the URL if using a hostname.

Comment by dimir [ 2022 Oct 18 ]

Overview

cURL expects any IPv6 hostname in the URL to be in square brackets

http://[::1]:8080/foo

because it needs to know which is the hostname part and which is the port part. We can't guess it automatically. The only thing is to make this configurable.

Below are the options I could think of, I see Option 3 as the cleanest solution.

Option 1

If we would have support for macros in the macro values:

ZBXNEXT-6068

we could add a macro to "App Apache by HTTP" template

{$APACHE.STATUS.HOST} => {HOST.HOST}

which a user could override on the host level

{$APACHE.STATUS.HOST} => [{HOST.HOST}]

and change the URL in Get status item:

{$APACHE.STATUS.SCHEME}://{HOST.CONN}:{$APACHE.STATUS.PORT}/{$APACHE.STATUS.PATH} 

to

{$APACHE.STATUS.SCHEME}://{$APACHE.STATUS.HOST}:{$APACHE.STATUS.PORT}/{$APACHE.STATUS.PATH} 

Pros

  • user will be able to override the macro on the host level

Cons

  • additional functionality to implement
  • no automatic handling

Option 2

Move the whole URL of the Get status item to the macro:

{$APACHE.STATUS.URL} => http://{HOST.CONN}:80/server-status?auto

Pros

  • user will be able to override the macro on the host level

Cons

  • no automatic handling

Option 3

Add support of new macro function to format the hostname part of the URL, e. g. urlform():

{{HOST.*}.urlform()} => returns "DNS", "IPv4", "[IPv6]"

Pros

  • automatic handling

Cons

  • additional functionality to implement

Option 4

Add new macro e. g.

{HOST.CONNURL} 

that will return IPv6 address in square brackets.

Pros

  • automatic handling

Cons

  • additional functionality to implement

Option 5

On level of substitute_simple_macros() detect that it's URL situation and add square brackets automatically.

Pros

  • automatic handling

Cons

  • additional functionality to implement
  • implement for each place where used

Additional thoughts

Implement (probably not in the scope of this task) escaping of macro values.

{ITEM.LASTVALUE1.escape(<rules>)}

Also would be nice to add support for macro functions to all macros.

Comment by dimir [ 2022 Oct 19 ]

Decided today that in order to fix this properly new functionality (ZBXNEXT) needs to be introduced first.

The only solutions for now that I see is:

  • editing URL field of Get status item on the host that uses IPv6 and adding square brackets around {HOST.CONN}
  • creating a copy template for IPv6 hosts with square brackets around {HOST.CONN}
Generated at Sat May 03 07:10:41 EEST 2025 using Jira 9.12.4#9120004-sha1:625303b708afdb767e17cb2838290c41888e9ff0.