mod_gearman icon indicating copy to clipboard operation
mod_gearman copied to clipboard

check_gearman is unable to parse IPv6 addresses

Open lamaral opened this issue 1 year ago • 1 comments

I tried using check_gearman against a server running with IPv6 only but I have been unsuccessful when using an IPv6 literal:

luiz@box:~$ /usr/lib/nagios/plugins/check_gearman -H ::1 -w 100 -c 200 -W 10 -C 20 -t 10
check_gearman CRITICAL - failed to connect to address 0.0.0.0 and port 0: Connection refused

luiz@box:~$ /usr/lib/nagios/plugins/check_gearman -H [::1] -w 100 -c 200 -W 10 -C 20 -t 10
check_gearman CRITICAL - Name or service not known

When I use a hostname, it works fine:

luiz@box:~$ /usr/lib/nagios/plugins/check_gearman -H localhost -w 100 -c 200 -W 10 -C 20 -t 10
check_gearman CRITICAL - Queue hostgroup_....

This last case is working over IPv6, as gearmand is listening on IPv6 only.

I dug a little bit and it seems like the issue originates during the address/port splitting in add_server() in common/utils.c.

My question now is: Would you accept a patch where the function is extended to properly parse IPv6 addresses specified within square brackets (i.e [::1]:4730)?

lamaral avatar Oct 05 '24 20:10 lamaral

Sure, a PR is always welcome. But we are in the process of migrating the tools around the neb module to go, so there is a check_gearman included over here:

  • https://github.com/ConSol-Monitoring/mod-gearman-worker-go/

You can give it a try, maybe it works with ipv6 already

sni avatar Oct 07 '24 09:10 sni