Implement fs stats.

This commit is contained in:
Orne Brocaar 2015-07-09 20:32:56 +02:00
parent 4743c9ab16
commit ec4079733e
3 changed files with 34 additions and 0 deletions

View File

@ -21,6 +21,7 @@ type node struct {
JVM interface{} `json:"jvm"` JVM interface{} `json:"jvm"`
ThreadPool interface{} `json:"thread_pool"` ThreadPool interface{} `json:"thread_pool"`
Network interface{} `json:"network"` Network interface{} `json:"network"`
FS interface{} `json:"fs"`
} }
const sampleConfig = ` const sampleConfig = `
@ -119,6 +120,9 @@ func (e *Elasticsearch) gatherUrl(url string, acc plugins.Accumulator) error {
if err := e.parseInterface(acc, "network", tags, n.Network); err != nil { if err := e.parseInterface(acc, "network", tags, n.Network); err != nil {
return err return err
} }
if err := e.parseInterface(acc, "fs", tags, n.FS); err != nil {
return err
}
} }
return nil return nil

View File

@ -74,4 +74,8 @@ func TestElasticsearch(t *testing.T) {
for key, val := range networkExpected { for key, val := range networkExpected {
assert.NoError(t, acc.ValidateTaggedValue(key, val, tags)) assert.NoError(t, acc.ValidateTaggedValue(key, val, tags))
} }
for key, val := range fsExpected {
assert.NoError(t, acc.ValidateTaggedValue(key, val, tags))
}
} }

View File

@ -381,6 +381,25 @@ const statsResponse = `
"in_errs": 0, "in_errs": 0,
"out_rsts": 0 "out_rsts": 0
} }
},
"fs": {
"timestamp": 1436460392946,
"total": {
"total_in_bytes": 19507089408,
"free_in_bytes": 16909316096,
"available_in_bytes": 15894814720
},
"data": [
{
"path": "/usr/share/elasticsearch/data/elasticsearch/nodes/0",
"mount": "/usr/share/elasticsearch/data",
"dev": "/dev/sda1",
"type": "ext4",
"total_in_bytes": 19507089408,
"free_in_bytes": 16909316096,
"available_in_bytes": 15894814720
}
]
} }
} }
} }
@ -641,3 +660,10 @@ var networkExpected = map[string]float64{
"network_tcp_estab_resets": 0, "network_tcp_estab_resets": 0,
"network_tcp_out_rsts": 0, "network_tcp_out_rsts": 0,
} }
var fsExpected = map[string]float64{
"fs_timestamp": 1436460392946,
"fs_total_free_in_bytes": 16909316096,
"fs_total_available_in_bytes": 15894814720,
"fs_total_total_in_bytes": 19507089408,
}