Update kibana docs

This commit is contained in:
Daniel Nelson 2020-01-23 15:33:13 -08:00
parent bc3429ed48
commit bbe2d12e7e
No known key found for this signature in database
GPG Key ID: CAAD59C9444F6155
4 changed files with 32 additions and 38 deletions

View File

@ -1,6 +1,6 @@
# Example Input Plugin # Example Input Plugin
The example plugin gathers metrics about example things. This description The `example` plugin gathers metrics about example things. This description
explains at a high level what the plugin does and provides links to where explains at a high level what the plugin does and provides links to where
additional information can be found. additional information can be found.
@ -41,6 +41,10 @@ mapped to the output.
- tag3 - tag3
- fields: - fields:
- field3 (integer, bytes) - field3 (integer, bytes)
- field4 (integer, green=1 yellow=2 red=3)
- field5 (string)
- field6 (float)
- field7 (boolean)
### Sample Queries ### Sample Queries

View File

@ -1,15 +1,17 @@
# Kibana input plugin # Kibana Input Plugin
The [kibana](https://www.elastic.co/) plugin queries Kibana status API to The `kibana` plugin queries the [Kibana][] API to obtain the service status.
obtain the health status of Kibana and some useful metrics.
This plugin has been tested and works on Kibana 6.x versions. - Telegraf minimum version: 1.8
- Kibana minimum tested version: 6.0
[Kibana]: https://www.elastic.co/
### Configuration ### Configuration
```toml ```toml
[[inputs.kibana]] [[inputs.kibana]]
## specify a list of one or more Kibana servers ## Specify a list of one or more Kibana servers
servers = ["http://localhost:5601"] servers = ["http://localhost:5601"]
## Timeout for HTTP requests ## Timeout for HTTP requests
@ -27,38 +29,27 @@ This plugin has been tested and works on Kibana 6.x versions.
# insecure_skip_verify = false # insecure_skip_verify = false
``` ```
### Status mappings ### Metrics
When reporting health (green/yellow/red), additional field `status_code`
is reported. Field contains mapping from status:string to status_code:int
with following rules:
- `green` - 1
- `yellow` - 2
- `red` - 3
- `unknown` - 0
### Measurements & Fields
- kibana - kibana
- status_code: integer (1, 2, 3, 0) - tags:
- heap_total_bytes: integer - name (Kibana reported name)
- heap_max_bytes: integer - source (Kibana server hostname or IP)
- heap_used_bytes: integer - status (Kibana health: green, yellow, red)
- uptime_ms: integer - version (Kibana version)
- response_time_avg_ms: float - fields:
- response_time_max_ms: integer - status_code (integer, green=1 yellow=2 red=3 unknown=0)
- concurrent_connections: integer - heap_total_bytes (integer)
- requests_per_sec: float - heap_max_bytes (integer; deprecated in 1.13.3: use `heap_total_bytes` field)
- heap_used_bytes (integer)
### Tags - uptime_ms (integer)
- response_time_avg_ms (float)
- name (Kibana reported name) - response_time_max_ms (integer)
- source (Kibana server hostname or IP) - concurrent_connections (integer)
- status (Kibana health: green, yellow, red) - requests_per_sec (float)
- version (Kibana version)
### Example Output ### Example Output
``` ```
kibana,host=myhost,name=my-kibana,source=localhost:5601,status=green,version=6.5.4 concurrent_connections=8i,heap_max_bytes=447778816i,heap_total_bytes=447778816i,heap_used_bytes=380603352i,requests_per_sec=1,response_time_avg_ms=57.6,response_time_max_ms=220i,status_code=1i,uptime_ms=6717489805i 1534864502000000000 kibana,host=myhost,name=my-kibana,source=localhost:5601,status=green,version=6.5.4 concurrent_connections=8i,heap_max_bytes=447778816i,heap_total_bytes=447778816i,heap_used_bytes=380603352i,requests_per_sec=1,response_time_avg_ms=57.6,response_time_max_ms=220i,status_code=1i,uptime_ms=6717489805i 1534864502000000000
``` ```

View File

@ -79,7 +79,7 @@ type heap struct {
} }
const sampleConfig = ` const sampleConfig = `
## specify a list of one or more Kibana servers ## Specify a list of one or more Kibana servers
servers = ["http://localhost:5601"] servers = ["http://localhost:5601"]
## Timeout for HTTP requests ## Timeout for HTTP requests

View File

@ -63,7 +63,7 @@ func checkKibanaStatusResult(version string, t *testing.T, acc *testutil.Accumul
func TestGather(t *testing.T) { func TestGather(t *testing.T) {
ks := newKibanahWithClient() ks := newKibanahWithClient()
ks.Servers = []string{"http://example.com:5601"} ks.Servers = []string{"http://example.com:5601"}
// Unit test for Kibana version < 6.5 // Unit test for Kibana version < 6.4
ks.client.Transport = newTransportMock(http.StatusOK, kibanaStatusResponse6_3) ks.client.Transport = newTransportMock(http.StatusOK, kibanaStatusResponse6_3)
var acc1 testutil.Accumulator var acc1 testutil.Accumulator
if err := acc1.GatherError(ks.Gather); err != nil { if err := acc1.GatherError(ks.Gather); err != nil {
@ -71,14 +71,13 @@ func TestGather(t *testing.T) {
} }
checkKibanaStatusResult(defaultTags6_3()["version"], t, &acc1) checkKibanaStatusResult(defaultTags6_3()["version"], t, &acc1)
//Unit test for Kibana version >= 6.5 //Unit test for Kibana version >= 6.4
ks.client.Transport = newTransportMock(http.StatusOK, kibanaStatusResponse6_5) ks.client.Transport = newTransportMock(http.StatusOK, kibanaStatusResponse6_5)
var acc2 testutil.Accumulator var acc2 testutil.Accumulator
if err := acc2.GatherError(ks.Gather); err != nil { if err := acc2.GatherError(ks.Gather); err != nil {
t.Fatal(err) t.Fatal(err)
} }
checkKibanaStatusResult(defaultTags6_5()["version"], t, &acc2) checkKibanaStatusResult(defaultTags6_5()["version"], t, &acc2)
} }
func newKibanahWithClient() *Kibana { func newKibanahWithClient() *Kibana {