Added IP to node description
Original commit: elastic/x-pack-elasticsearch@cfa42db133
This commit is contained in:
parent
63d0e97910
commit
0f3949b2ea
|
@ -20,6 +20,7 @@ import org.elasticsearch.common.logging.ESLogger;
|
|||
import org.elasticsearch.common.logging.ESLoggerFactory;
|
||||
import org.elasticsearch.common.network.NetworkUtils;
|
||||
import org.elasticsearch.common.settings.Settings;
|
||||
import org.elasticsearch.common.transport.InetSocketTransportAddress;
|
||||
import org.elasticsearch.common.unit.TimeValue;
|
||||
import org.elasticsearch.common.xcontent.ToXContent;
|
||||
import org.elasticsearch.common.xcontent.XContentBuilder;
|
||||
|
@ -272,6 +273,14 @@ public class ESExporter extends AbstractLifecycleComponent<ESExporter> implement
|
|||
builder.field("name", node.name());
|
||||
builder.field("transport_address", node.address());
|
||||
|
||||
if (node.address().uniqueAddressTypeId() == 1) { // InetSocket
|
||||
InetSocketTransportAddress address = (InetSocketTransportAddress) node.address();
|
||||
InetAddress inetAddress = address.address().getAddress();
|
||||
if (inetAddress != null) {
|
||||
builder.field("ip", inetAddress.getHostAddress());
|
||||
}
|
||||
}
|
||||
|
||||
if (hostname != null) {
|
||||
builder.field("hostname", hostname);
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue