From 7121e1a3b09fc12f57ed461aedeb8a423a6a13e9 Mon Sep 17 00:00:00 2001 From: Jonathan Cross Date: Tue, 13 Oct 2015 22:01:07 -0400 Subject: [PATCH] fixes based on comments --- plugins/zookeeper/README.md | 62 +++++++++++++++++++++++++++++ plugins/zookeeper/zookeeper_test.go | 16 +++++++- scripts/docker-compose.yml | 5 +++ 3 files changed, 81 insertions(+), 2 deletions(-) create mode 100644 plugins/zookeeper/README.md diff --git a/plugins/zookeeper/README.md b/plugins/zookeeper/README.md new file mode 100644 index 000000000..c2dc6b540 --- /dev/null +++ b/plugins/zookeeper/README.md @@ -0,0 +1,62 @@ +## Telegraf Plugin: Zookeeper + +#### Description + +The zookeeper plugin collects variables outputted from the 'mntr' command +[Zookeeper Admin](https://zookeeper.apache.org/doc/trunk/zookeeperAdmin.html). + +``` +echo mntr | nc localhost 2181 + + zk_version 3.4.0 + zk_avg_latency 0 + zk_max_latency 0 + zk_min_latency 0 + zk_packets_received 70 + zk_packets_sent 69 + zk_outstanding_requests 0 + zk_server_state leader + zk_znode_count 4 + zk_watch_count 0 + zk_ephemerals_count 0 + zk_approximate_data_size 27 + zk_followers 4 - only exposed by the Leader + zk_synced_followers 4 - only exposed by the Leader + zk_pending_syncs 0 - only exposed by the Leader + zk_open_file_descriptor_count 23 - only available on Unix platforms + zk_max_file_descriptor_count 1024 - only available on Unix platforms +``` + +## Measurements: +#### Zookeeper measurements: + +Meta: +- units: int64 +- tags: `server= port=` + +Measurement names: +- avg_latency +- max_latency +- min_latency +- packets_received +- packets_sent +- outstanding_requests +- znode_count +- watch_count +- ephemerals_count +- approximate_data_size +- followers #only exposed by the Leader +- synced_followers #only exposed by the Leader +- pending_syncs #only exposed by the Leader +- open_file_descriptor_count +- max_file_descriptor_count + +#### Zookeeper string measurements: + +Meta: +- units: string +- tags: `server= port=` + +Measurement names: +- zk_version +- server_state \ No newline at end of file diff --git a/plugins/zookeeper/zookeeper_test.go b/plugins/zookeeper/zookeeper_test.go index 2f8fba114..ba4bd9cab 100644 --- a/plugins/zookeeper/zookeeper_test.go +++ b/plugins/zookeeper/zookeeper_test.go @@ -8,7 +8,7 @@ import ( "github.com/stretchr/testify/require" ) -func TestMemcachedGeneratesMetrics(t *testing.T) { +func TestZookeeperGeneratesMetrics(t *testing.T) { if testing.Short() { t.Skip("Skipping integration test in short mode") } @@ -22,7 +22,19 @@ func TestMemcachedGeneratesMetrics(t *testing.T) { err := z.Gather(&acc) require.NoError(t, err) - intMetrics := []string{"zookeeper_avg_latency", "zookeeper_packets_sent", "zookeeper_znode_count", "zookeeper_open_file_descriptor_count", "zookeeper_max_file_descriptor_count"} + intMetrics := []string{"zookeeper_avg_latency", + "zookeeper_max_latency", + "zookeeper_min_latency", + "zookeeper_packets_received", + "zookeeper_packets_sent", + "zookeeper_outstanding_requests", + "zookeeper_znode_count", + "zookeeper_watch_count", + "zookeeper_ephemerals_count", + "zookeeper_approximate_data_size", + "zookeeper_pending_syncs", + "zookeeper_open_file_descriptor_count", + "zookeeper_max_file_descriptor_count"} for _, metric := range intMetrics { assert.True(t, acc.HasIntValue(metric), metric) diff --git a/scripts/docker-compose.yml b/scripts/docker-compose.yml index a04d9ff91..3e72bb814 100644 --- a/scripts/docker-compose.yml +++ b/scripts/docker-compose.yml @@ -42,3 +42,8 @@ redis: image: redis ports: - "6379:6379" + +zookeeper: + image: spotify/kafka + ports: + - "2181:2181"