Skip to content

Commit 688c3fb

Browse files
author
Jef Spaleta
authored
Merge pull request #30 from miguelmatosduarte/use_zookeeper_stats_names_instead_of_hardcoded_line_numbers_in_checks
Grab `mntr` output stats by name instead of line number in Zookeeper checks
2 parents 1cfa497 + 9b41d42 commit 688c3fb

File tree

3 files changed

+3
-3
lines changed

3 files changed

+3
-3
lines changed

bin/check-zookeeper-file-descriptors.rb

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -70,7 +70,7 @@ def run
7070
end
7171

7272
result = ready.first.first.read.chomp.split("\n")
73-
avg_fd = (result[13].split("\t")[1].to_f / result[14].split("\t")[1].to_f)
73+
avg_fd = (result.grep(/zk_open_file_descriptor_count/)[0].split("\t")[1].to_f / result.grep(/zk_max_file_descriptor_count/)[0].split("\t")[1].to_f)
7474

7575
ok %(Zookeeper's open file descriptors rate is #{avg_fd}) if avg_fd < config[:fd_critical]
7676
critical %(Zookeeper's open file descriptors rate is #{avg_fd}, which is more than #{config[:fd_critical]} threshold)

bin/check-zookeeper-latency.rb

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -67,7 +67,7 @@ def run
6767
end
6868

6969
result = ready.first.first.read.chomp.split("\n")
70-
avg_latency = result[1].split("\t")[1].to_i
70+
avg_latency = result.grep(/zk_avg_latency/)[0].split("\t")[1].to_i
7171

7272
ok %(Zookeeper has average latency #{avg_latency}) if avg_latency < config[:avg_latency_critical]
7373
critical %(Zookeeper's average latency is #{avg_latency}, which is more than #{config[:avg_latency_critical]} threshold)

bin/check-zookeeper-reqs.rb

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -70,7 +70,7 @@ def run
7070
end
7171

7272
result = ready.first.first.read.chomp.split("\n")
73-
out_reqs = result[7].split("\t")[1].to_i
73+
out_reqs = result.grep(/zk_outstanding_requests/)[0].split("\t")[1].to_i
7474

7575
ok %(Zookeeper has #{out_reqs} outstanding requests) if out_reqs < config[:out_reqs_critical]
7676
critical %(Zookeeper has #{out_reqs} outstanding requests, which is more than #{config[:out_reqs_critical]} threshold)

0 commit comments

Comments
 (0)