Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

collectd-mod-network: network plugin: getaddrinfo (0.0.0.0, 25826) failed: Name has no usable address #25795

Open
adelton opened this issue Jan 20, 2025 · 1 comment

Comments

@adelton
Copy link

adelton commented Jan 20, 2025

On a GL.iNet GL-MT6000, collectd start but when it is configured to listen on 0.0.0.0 with

config collectd_network_listen   
        option host '0.0.0.0'   
        option port '25826'      

in /etc/config/luci_statistics, freshly after reboot it does not listen on the port -- netstat -uln does not show

Proto Recv-Q Send-Q Local Address           Foreign Address         State       
udp        0      0 0.0.0.0:25826           0.0.0.0:*                           

and data from remote machines are not collected.

Restarting the service make the daemon listen fine and peace is restored.

In logread there is

Mon Jan 20 10:34:05 2025 kern.info kernel: [   12.455561] NET: Registered PF_PPPOX protocol family
Mon Jan 20 10:34:05 2025 user.info kernel: [   12.462667] kmodloader: done loading kernel modules from /etc/modules.d/*
Mon Jan 20 10:34:05 2025 authpriv.info dropbear[1558]: Not backgrounding
Mon Jan 20 10:34:06 2025 user.notice : Added device handler type: bonding
Mon Jan 20 10:34:06 2025 user.notice : Added device handler type: 8021ad
Mon Jan 20 10:34:06 2025 user.notice : Added device handler type: 8021q
Mon Jan 20 10:34:06 2025 user.notice : Added device handler type: macvlan
Mon Jan 20 10:34:06 2025 user.notice : Added device handler type: veth
Mon Jan 20 10:34:06 2025 user.notice : Added device handler type: bridge
Mon Jan 20 10:34:06 2025 user.notice : Added device handler type: Network device
Mon Jan 20 10:34:06 2025 user.notice : Added device handler type: tunnel
Mon Jan 20 10:34:06 2025 daemon.notice procd: /etc/rc.d/S25packet_steering: pid 595's current affinity list: 0-3
Mon Jan 20 10:34:06 2025 daemon.notice procd: /etc/rc.d/S25packet_steering: pid 595's new affinity list: 0
Mon Jan 20 10:34:06 2025 daemon.notice procd: /etc/rc.d/S25packet_steering: pid 596's current affinity list: 0-3
Mon Jan 20 10:34:06 2025 daemon.notice procd: /etc/rc.d/S25packet_steering: pid 596's new affinity list: 0
Mon Jan 20 10:34:06 2025 daemon.notice wpa_supplicant[1714]: Successfully initialized wpa_supplicant
Mon Jan 20 10:34:06 2025 daemon.err collectd[2087]: configfile: stat (/etc/collectd/conf.d/*.conf) failed: No such file or directory
Mon Jan 20 10:34:06 2025 daemon.err collectd[2087]: plugin_load: plugin "cpu" successfully loaded.
Mon Jan 20 10:34:06 2025 daemon.err collectd[2087]: plugin_load: plugin "interface" successfully loaded.
Mon Jan 20 10:34:06 2025 daemon.err collectd[2087]: plugin_load: plugin "iwinfo" successfully loaded.
Mon Jan 20 10:34:06 2025 daemon.err collectd[2087]: plugin_load: plugin "load" successfully loaded.
Mon Jan 20 10:34:06 2025 daemon.err collectd[2087]: plugin_load: plugin "memory" successfully loaded.
Mon Jan 20 10:34:06 2025 daemon.err collectd[2087]: plugin_load: plugin "network" successfully loaded.
Mon Jan 20 10:34:06 2025 daemon.err collectd[2087]: network plugin: getaddrinfo (0.0.0.0, 25826) failed: Name has no usable address
Mon Jan 20 10:34:06 2025 daemon.err collectd[2087]: network plugin: network_config_add_listen: sockent_server_listen failed.
Mon Jan 20 10:34:06 2025 daemon.err collectd[2087]: network plugin: getaddrinfo (0.0.0.0, 25252) failed: Name has no usable address
Mon Jan 20 10:34:06 2025 daemon.err collectd[2087]: network plugin: network_config_add_listen: sockent_server_listen failed.
Mon Jan 20 10:34:06 2025 daemon.err collectd[2087]: plugin_load: plugin "ping" successfully loaded.
Mon Jan 20 10:34:06 2025 kern.info kernel: [   14.264631] mtk_soc_eth 15100000.ethernet eth0: Link is Down
Mon Jan 20 10:34:06 2025 daemon.err collectd[2087]: plugin_load: plugin "rrdtool" successfully loaded.
Mon Jan 20 10:34:06 2025 daemon.err collectd[2087]: rrdtool plugin: RRASingle = true: creating only AVERAGE RRAs
Mon Jan 20 10:34:06 2025 daemon.err collectd[2087]: plugin_load: plugin "thermal" successfully loaded.
Mon Jan 20 10:34:06 2025 daemon.err collectd[2087]: ping plugin: ping_host_add (192.168.41.1) failed: getaddrinfo: Name has no usable address
Mon Jan 20 10:34:06 2025 daemon.err collectd[2087]: ping plugin: No host could be added to ping object. Giving up.
Mon Jan 20 10:34:06 2025 daemon.err collectd[2087]: Initialization complete, entering read-loop.
Mon Jan 20 10:34:06 2025 kern.info kernel: [   14.283466] mtk_soc_eth 15100000.ethernet eth0: configuring for fixed/2500base-x link mode
Mon Jan 20 10:34:06 2025 kern.info kernel: [   14.291978] mtk_soc_eth 15100000.ethernet eth0: Link is Up - 2.5Gbps/Full - flow control rx/tx
Mon Jan 20 10:34:06 2025 kern.info kernel: [   14.294059] mt7530-mdio mdio-bus:1f lan1: configuring for phy/sgmii link mode
Mon Jan 20 10:34:06 2025 user.notice ucitrack: Setting up /etc/config/luci-splash reload dependency on /etc/config/firewall
Mon Jan 20 10:34:06 2025 user.notice ucitrack: Setting up /etc/config/qos reload dependency on /etc/config/firewall
Mon Jan 20 10:34:06 2025 user.notice ucitrack: Setting up /etc/config/miniupnpd reload dependency on /etc/config/firewall
Mon Jan 20 10:34:06 2025 kern.info kernel: [   14.340797] br-lan: port 1(lan1) entered blocking state
Mon Jan 20 10:34:06 2025 kern.info kernel: [   14.346030] br-lan: port 1(lan1) entered disabled state
Mon Jan 20 10:34:06 2025 kern.info kernel: [   14.351325] mt7530-mdio mdio-bus:1f lan1: entered allmulticast mode
Mon Jan 20 10:34:06 2025 kern.info kernel: [   14.357588] mtk_soc_eth 15100000.ethernet eth0: entered allmulticast mode
Mon Jan 20 10:34:06 2025 user.notice ucitrack: Setting up /etc/config/odhcpd reload dependency on /etc/config/dhcp
Mon Jan 20 10:34:06 2025 kern.info kernel: [   14.367210] mt7530-mdio mdio-bus:1f lan1: entered promiscuous mode
Mon Jan 20 10:34:06 2025 daemon.notice netifd: Interface 'lan' is enabled
Mon Jan 20 10:34:06 2025 daemon.notice netifd: Interface 'lan' is setting up now
Mon Jan 20 10:34:06 2025 daemon.notice netifd: Interface 'lan' is now up
Mon Jan 20 10:34:06 2025 kern.info kernel: [   14.385532] mt7530-mdio mdio-bus:1f lan2: configuring for phy/gmii link mode
Mon Jan 20 10:34:06 2025 kern.info kernel: [   14.396279] br-lan: port 2(lan2) entered blocking state
Mon Jan 20 10:34:06 2025 kern.info kernel: [   14.401623] br-lan: port 2(lan2) entered disabled state

So it seems like collectd does not wait for network to fully start up, or indeed even for getaddrinfo to be usable.

@adelton
Copy link
Author

adelton commented Jan 20, 2025

I was able to workaround the situation by creating /etc/init.d/luci_statistics_network_ready with

#!/bin/sh /etc/rc.common

USE_PROCD=1
START=78
STOP=99

start_service() {
	procd_open_instance
	procd_set_param command /bin/true
	procd_close_instance
}
service_triggers() {
	procd_add_interface_trigger "interface.*.up" "lan" /etc/init.d/luci_statistics reload
}

and then running

# chmod a+x /etc/init.d/luci_statistics_network_ready
# /etc/init.d/luci_statistics_network_ready enable
# reboot

No idea if this is the most efficient / fail-proof way of ensuring collectd get restarted after the lan gets reasonably configured, to give it a chance to try to listen again.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant