Merge pull request #18750 from champtar/prom-lua-wait
prometheus-node-exporter-lua: fix waiting for interface
This commit is contained in:
commit
6d3eb376fa
|
@ -4,7 +4,7 @@
|
||||||
include $(TOPDIR)/rules.mk
|
include $(TOPDIR)/rules.mk
|
||||||
|
|
||||||
PKG_NAME:=prometheus-node-exporter-lua
|
PKG_NAME:=prometheus-node-exporter-lua
|
||||||
PKG_VERSION:=2022.04.30
|
PKG_VERSION:=2022.06.12
|
||||||
PKG_RELEASE:=1
|
PKG_RELEASE:=1
|
||||||
|
|
||||||
PKG_MAINTAINER:=Etienne CHAMPETIER <champetier.etienne@gmail.com>
|
PKG_MAINTAINER:=Etienne CHAMPETIER <champetier.etienne@gmail.com>
|
||||||
|
|
|
@ -11,13 +11,22 @@ _log() {
|
||||||
start_service() {
|
start_service() {
|
||||||
. /lib/functions/network.sh
|
. /lib/functions/network.sh
|
||||||
|
|
||||||
local interface port bind
|
local interface port bind4 bind6
|
||||||
|
|
||||||
config_load prometheus-node-exporter-lua.main
|
config_load prometheus-node-exporter-lua.main
|
||||||
config_get keepalive "main" http_keepalive 70
|
config_get keepalive "main" http_keepalive 70
|
||||||
config_get interface "main" listen_interface "loopback"
|
config_get interface "main" listen_interface "loopback"
|
||||||
config_get port "main" listen_port 9100
|
config_get port "main" listen_port 9100
|
||||||
|
|
||||||
|
[ "$interface" = "*" ] || {
|
||||||
|
network_get_ipaddr bind4 "$interface"
|
||||||
|
network_get_ipaddr6 bind6 "$interface"
|
||||||
|
[ -n "$bind4$bind6" ] || {
|
||||||
|
_log "defering start until listen interface $interface becomes ready"
|
||||||
|
return 0
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
procd_open_instance
|
procd_open_instance
|
||||||
|
|
||||||
procd_set_param command /usr/sbin/uhttpd -f -c /dev/null -l / -L /usr/bin/prometheus-node-exporter-lua
|
procd_set_param command /usr/sbin/uhttpd -f -c /dev/null -l / -L /usr/bin/prometheus-node-exporter-lua
|
||||||
|
@ -26,14 +35,8 @@ start_service() {
|
||||||
if [ "$interface" = "*" ]; then
|
if [ "$interface" = "*" ]; then
|
||||||
procd_append_param command -p $port
|
procd_append_param command -p $port
|
||||||
else
|
else
|
||||||
network_is_up "$interface" || {
|
[ -n "$bind4" ] && procd_append_param command -p $bind4:$port
|
||||||
_log "defering start until listen interface $interface becomes ready"
|
[ -n "$bind6" ] && procd_append_param command -p [$bind6]:$port
|
||||||
return 0
|
|
||||||
}
|
|
||||||
network_get_ipaddr6 bind "$interface"
|
|
||||||
[ -n "$bind" ] && procd_append_param command -p [$bind]:$port
|
|
||||||
network_get_ipaddr bind "$interface"
|
|
||||||
[ -n "$bind" ] && procd_append_param command -p $bind:$port
|
|
||||||
fi
|
fi
|
||||||
|
|
||||||
procd_set_param stdout 1
|
procd_set_param stdout 1
|
||||||
|
|
Loading…
Reference in New Issue