Bind Metricbeats to specific ip address

Hi everyone,

I want to bind Metricbeats to a specific IP-address. Is there a way to do so?
For a Elasticsearch node I am able to set it in /etc/elasticsearch/elasticsearch.yml but for Metricbeats I am missing a setting like this.

elasticsearch.yml:
...
---------------------------------- Network -----------------------------------

Set the bind address to a specific IP (IPv4 or IPv6):

network.host: 0.0.0.0
...

Your help is highly appreciated!

Thanks and regards,
Chris

Do you mean for when it sends data to Elasticsearch?

Hi Mark,

yes, we want to send to ES-nodes. We have multiple network interfaces on the machine where Metricbeats is running. And just a particular one can reach the Elasticsearch node.

To communicate via curl from the machine where the Metricbeats is installed to the ES node it would be for instance work with:
curl --interface 10.30.150.32 -XGET http://10.30.134.155:9200/_cat/indices

I don't think you will need to worry. The OS will just pick the interface it needs to send to that IP.

The Problem is that the connection will work in case if the interface could be specified like in the curl command. If I use curl without "--interface" parameter the connection will not work. I think that's why Metricbeats is currently not able to connect to that particular ES-node. I am missing the setting in the metricbeats.yml "network.host" to bind the Metricbeats-process to a specific IPv4 address on the server.

That's kind of odd. It's been a while since I have looked at this sort of problem but surely the OS should be handling routing so this isn't necessary?

Hi Mark, let me drop some more info here. Imagine that you have a host you like to monitor using Metricbeat. There are 3 network interfaces on that host with following IP addresses - 10.30.146.32, 10.30.150.32, 10.30.154.32. The default route configured through interface having IP 10.30.146.32. But the desired IP address for Metricbeat to send data to Elasticsearch is 10.30.150.32.

So in general if you try to open TCP connection and you define only the remote (destination/server's) IP address and the remote port the OS will automatically pick a "suitable" local (source/client's) IP address and a random local unused port to bind to.

But there is a possibility to specify the local (source/client's) IP address and the local port to bind to when opening TCP connection. The Metricbeat does not support such configuration option.

I had a quick look into beats source code and the idea would be to use

net.Dialer{Timeout: timeout, LocalAddr: localAddr}

to specify a local bind address.

This topic was automatically closed 28 days after the last reply. New replies are no longer allowed.