Closed PierreRustOrange closed 2 years ago
Actually, this issue does not only happen with docker compose but also prevent using the socket interface when using powerapi in k8s, if the sensor and the formula are not running in the same pod (as we were doing until now) : there is not way to get the actual formula ip adress and use it in the configuration, we can only use network names.
When using the socket output, the cofiguration requires using an IP address, which is not convenient in container environments. For example, when running the sensor and a formula with docker compose, we don't know the address at which the formula (i.e. the socket server the sensor must connect to) runs but we can use the name of the service, which will be resolved by docker to the corresponding ip address. However, as the sensor does not resolve address names, this does not work.
This can easily be tested by running the sensor with a name for the
-U
parameter :Due to another issue (see PR #13) This command currently simply blocks, once the error is fixed it fails even tough a socket server is running at localhost.
A solution would be to use
getaddrinfo
to resolve the address name when the supplied argument is not a valid IP address.