y-ken/elasticsearch-munin — pull request #2 by y-ken (2014-04-22 01:55:02+00:00)
Title: Allow override $host,$port with env.{host,port} and Fix values calculation

----------
Note: quoted from: https://github.com/mickm/elasticsearch-munin/pull/3
----------

$host and $port variables are hardcoded to 'localhost' and 9200

This commit allow to override these values.

```
# cat /etc/munin/plugin-conf.d/elasticsearch
[elasticsearch_*]
env.host x.x.x.x
env.port 9300
```

Values are wrong when having multi nodes. The last one is used.

```
"cluster_name": "elasticsearch",
"nodes": {
"1pZgzWkNTUqJsPfYcxH6qA": {
(...)
"docs": {
"count": 1221827,
"deleted": 0
},
(...)
"XU_9yAt0R-C6vyaK_iRVpw": {
(...)
"docs": {
"count": 0,
"deleted": 0
},
```
Plugin return 0 instead of 1221827 + 0 = 1221827

Values in hash %out are not initialize to zero.