Implement network stats.

This commit is contained in:
Orne Brocaar 2015-07-09 20:23:04 +02:00
parent ac54b7cdd1
commit 4743c9ab16
3 changed files with 35 additions and 0 deletions

View File

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

View File

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

View File

@ -367,6 +367,20 @@ const statsResponse = `
"largest": 1,
"completed": 0
}
},
"network": {
"tcp": {
"active_opens": 13,
"passive_opens": 16,
"curr_estab": 29,
"in_segs": 113,
"out_segs": 97,
"retrans_segs": 0,
"estab_resets": 0,
"attempt_fails": 0,
"in_errs": 0,
"out_rsts": 0
}
}
}
}
@ -614,3 +628,16 @@ var threadPoolExpected = map[string]float64{
"thread_pool_flush_largest": 5,
"thread_pool_flush_completed": 3,
}
var networkExpected = map[string]float64{
"network_tcp_in_errs": 0,
"network_tcp_passive_opens": 16,
"network_tcp_curr_estab": 29,
"network_tcp_in_segs": 113,
"network_tcp_out_segs": 97,
"network_tcp_retrans_segs": 0,
"network_tcp_attempt_fails": 0,
"network_tcp_active_opens": 13,
"network_tcp_estab_resets": 0,
"network_tcp_out_rsts": 0,
}