Process stats from ElasticSearch matched by IP

In some scenarios ElasticSearch returns its IP address
as 'host' value. This was filtered out when looking for
matching hostname. This commit adds IP address to
allowed 'hostnames'

Change-Id: I3fd1adf291c2eead0c8c601140a5e4b1487ba9a4
This commit is contained in:
Jakub Wachowski 2016-10-24 13:41:11 +02:00
parent 1544d4cb49
commit 7f7588d10f
1 changed files with 2 additions and 1 deletions

View File

@ -253,7 +253,8 @@ class ElasticSearch(AgentCheck):
hostnames = (
self.hostname.decode('utf-8'),
socket.gethostname().decode('utf-8'),
socket.getfqdn().decode('utf-8')
socket.getfqdn().decode('utf-8'),
socket.gethostbyname(socket.gethostname()).decode('utf-8')
)
if node_hostname.decode('utf-8') in hostnames:
for metric in self.METRICS: