influxdb/influxdb — pull request #635 by chobie (2014-06-11 14:30:02+00:00)
Title: [POC] add statistic json api

Currently, I'm working json statistic api as for we'd like to monitoring InfluxDB metrics.

Probably it has worthless values right now, but ready for discussion.
Feedback appreciated.

```
Endpoint: /statistic
Authentication: requires cluster admin
```

json output
```
{
"name": "macbook.local",
"version": "InfluxDB vdev (git: b7fc984) (leveldb: 1.15)",
"pid": 53751,
"uptime": 17.084708002,
"time": 1402495659,
"api": {
"http": {
"bytes_written": 31480,
"bytes_read": 147456,
"current_connections": 6,
"connections": 8,
"response": {
"min": 3.1765000000000005e-05,
"avg": 0.00010988075000000001,
"max": 0.000158838,
"status": [
{
"code": 401,
"count": 9
},
{
"code": 200,
"count": 5
}
]
}
}
},
"wal": {
"opening": 1,
"append_entry": 0,
"commit_entry": 3119,
"bookmark_entry": 0
},
"shard": {
"opening": 0,
"delete": 0
},
"coordinator": {
"cmd_query": 0,
"cmd_select": 0,
"cmd_write_series": 0,
"cmd_delete": 0,
"cmd_drop": 0,
"cmd_list_series": 0
},
"net": {
"current_connections": 6,
"connections": 8,
"bytes_written": 31480,
"bytes_read": 147456
},
"leveldb": {
"points_read": 0,
"points_write": 193378,
"points_delete": 0,
"min": 0,
"avg": 0,
"max": 0,
"bytes_written": 700833
},
"go": {
"current_goroutines": 23,
"goroutines_avg": 22,
"cgo_call": 589508
},
"sys": {
"rusage": {
"user": {
"sec": 3,
"usec": 238049
},
"sys": {
"sec": 0,
"usec": 381271
}
},
"sys_bytes": 6957288,
"alloc": 1848104
},
"raft": {},
"protobuf": {}
}
```

To my knowledge LevelDB doesn't provide current openings file descriptors count. so we should correct that with another agent like (https://github.com/chobie/influxdb-monitor)