diff --git a/plugins/inputs/EXAMPLE_README.md b/plugins/inputs/EXAMPLE_README.md index 8ac55876b..b15b9caf2 100644 --- a/plugins/inputs/EXAMPLE_README.md +++ b/plugins/inputs/EXAMPLE_README.md @@ -1,6 +1,6 @@ # 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 additional information can be found. @@ -41,6 +41,10 @@ mapped to the output. - tag3 - fields: - field3 (integer, bytes) + - field4 (integer, green=1 yellow=2 red=3) + - field5 (string) + - field6 (float) + - field7 (boolean) ### Sample Queries diff --git a/plugins/inputs/kibana/README.md b/plugins/inputs/kibana/README.md index f24e3d33a..73bf4a298 100644 --- a/plugins/inputs/kibana/README.md +++ b/plugins/inputs/kibana/README.md @@ -1,15 +1,17 @@ -# Kibana input plugin +# Kibana Input Plugin -The [kibana](https://www.elastic.co/) plugin queries Kibana status API to -obtain the health status of Kibana and some useful metrics. +The `kibana` plugin queries the [Kibana][] API to obtain the service status. -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 ```toml [[inputs.kibana]] - ## specify a list of one or more Kibana servers + ## Specify a list of one or more Kibana servers servers = ["http://localhost:5601"] ## Timeout for HTTP requests @@ -27,38 +29,27 @@ This plugin has been tested and works on Kibana 6.x versions. # insecure_skip_verify = false ``` -### Status mappings - -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 +### Metrics - kibana - - status_code: integer (1, 2, 3, 0) - - heap_total_bytes: integer - - heap_max_bytes: integer - - heap_used_bytes: integer - - uptime_ms: integer - - response_time_avg_ms: float - - response_time_max_ms: integer - - concurrent_connections: integer - - requests_per_sec: float - -### Tags - -- name (Kibana reported name) -- source (Kibana server hostname or IP) -- status (Kibana health: green, yellow, red) -- version (Kibana version) + - tags: + - name (Kibana reported name) + - source (Kibana server hostname or IP) + - status (Kibana health: green, yellow, red) + - version (Kibana version) + - fields: + - status_code (integer, green=1 yellow=2 red=3 unknown=0) + - heap_total_bytes (integer) + - heap_max_bytes (integer; deprecated in 1.13.3: use `heap_total_bytes` field) + - heap_used_bytes (integer) + - uptime_ms (integer) + - response_time_avg_ms (float) + - response_time_max_ms (integer) + - concurrent_connections (integer) + - requests_per_sec (float) ### 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 ``` diff --git a/plugins/inputs/kibana/kibana.go b/plugins/inputs/kibana/kibana.go index 64353013c..4b7e3c5c5 100644 --- a/plugins/inputs/kibana/kibana.go +++ b/plugins/inputs/kibana/kibana.go @@ -79,7 +79,7 @@ type heap struct { } const sampleConfig = ` - ## specify a list of one or more Kibana servers + ## Specify a list of one or more Kibana servers servers = ["http://localhost:5601"] ## Timeout for HTTP requests diff --git a/plugins/inputs/kibana/kibana_test.go b/plugins/inputs/kibana/kibana_test.go index 537f6b560..3dfed9edf 100644 --- a/plugins/inputs/kibana/kibana_test.go +++ b/plugins/inputs/kibana/kibana_test.go @@ -63,7 +63,7 @@ func checkKibanaStatusResult(version string, t *testing.T, acc *testutil.Accumul func TestGather(t *testing.T) { ks := newKibanahWithClient() 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) var acc1 testutil.Accumulator if err := acc1.GatherError(ks.Gather); err != nil { @@ -71,14 +71,13 @@ func TestGather(t *testing.T) { } 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) var acc2 testutil.Accumulator if err := acc2.GatherError(ks.Gather); err != nil { t.Fatal(err) } checkKibanaStatusResult(defaultTags6_5()["version"], t, &acc2) - } func newKibanahWithClient() *Kibana {