From 3f6c46e1ec858ad880018815efb58e0ff0417a99 Mon Sep 17 00:00:00 2001 From: Orne Brocaar Date: Wed, 8 Jul 2015 23:07:10 +0200 Subject: [PATCH] Add node_name to tags. --- plugins/elasticsearch/elasticsearch.go | 2 ++ plugins/elasticsearch/elasticsearch_test.go | 1 + 2 files changed, 3 insertions(+) diff --git a/plugins/elasticsearch/elasticsearch.go b/plugins/elasticsearch/elasticsearch.go index 74428680d..6294bcaaf 100644 --- a/plugins/elasticsearch/elasticsearch.go +++ b/plugins/elasticsearch/elasticsearch.go @@ -13,6 +13,7 @@ const indicesStatsPathLocal = "/_nodes/_local/stats/indices" type node struct { Host string `json:"host"` + Name string `json:"name"` Indices map[string]map[string]interface{} `json:"indices"` } @@ -85,6 +86,7 @@ func (e *Elasticsearch) gatherUrl(url string, acc plugins.Accumulator) error { for _, n := range esRes.Nodes { tags := map[string]string{ "node_host": n.Host, + "node_name": n.Name, "cluster_name": esRes.ClusterName, } diff --git a/plugins/elasticsearch/elasticsearch_test.go b/plugins/elasticsearch/elasticsearch_test.go index 6f7944043..417f3829e 100644 --- a/plugins/elasticsearch/elasticsearch_test.go +++ b/plugins/elasticsearch/elasticsearch_test.go @@ -249,6 +249,7 @@ func TestElasticsearch(t *testing.T) { tags := map[string]string{ "node_host": "test", + "node_name": "test.host.com", "cluster_name": "es-testcluster", }