Not without patching the code, it only opens a v4 socket if v6 fails to
bind (and seems the httpd library they use won't cope with multiple binds).
817 static struct MHD_Daemon *prom_start_daemon() {
818 /* {{{ */
819 int fd = prom_open_socket(PF_INET6);
820 if (fd == -1)
821 fd = prom_open_socket(PF_INET);
822 if (fd == -1) {
823 ERROR("write_prometheus plugin: Opening a listening socket for
[%s]:%hu " 824 "failed.",
825 (httpd_host != NULL) ? httpd_host : "::", httpd_port); 826 return NULL;
827 }
That code doesn't look very maintained anyway though, you might have better
luck with https://github.com/prometheus/collectd_exporter (not in ports,
but you can probably crib from node_exporter and use "make
modgo-gen-modules" to generate modules.inc).
--
Sent from a phone, apologies for poor formatting.
On 3 February 2023 08:24:40 Joel Carnat <[email protected]> wrote:
Hello,
I have installed collectd-prometheus-5.8.1p3 on OpenBSD 7.2-STABLE/amd64
and collectd-prometheus-5.12.0p0 on OPenBSD 7.2-CURRENT/arm64. I added
the following to my /etc/collectd.conf:
<Plugin "write_prometheus">
Port 9103
</Plugin>
In both case, the webserver only listens on IPv6, not IPv4.
# netstat -na | grep 9103
tcp6 0 0 *.9103 *.* LISTEN
I have tried setting a "Host" parameter but that has no effects.
Is this known / expected?
Is there a way to listen on the IPv4 addresses?
Thank you,
Joel C.