Skip to content

Commit

Permalink
Merge pull request #30 from miguelmatosduarte/use_zookeeper_stats_nam…
Browse files Browse the repository at this point in the history
…es_instead_of_hardcoded_line_numbers_in_checks

Grab `mntr` output stats by name instead of line number in Zookeeper checks
  • Loading branch information
Jef Spaleta authored Mar 13, 2020
2 parents 1cfa497 + 9b41d42 commit 688c3fb
Show file tree
Hide file tree
Showing 3 changed files with 3 additions and 3 deletions.
2 changes: 1 addition & 1 deletion bin/check-zookeeper-file-descriptors.rb
Original file line number Diff line number Diff line change
Expand Up @@ -70,7 +70,7 @@ def run
end

result = ready.first.first.read.chomp.split("\n")
avg_fd = (result[13].split("\t")[1].to_f / result[14].split("\t")[1].to_f)
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)

ok %(Zookeeper's open file descriptors rate is #{avg_fd}) if avg_fd < config[:fd_critical]
critical %(Zookeeper's open file descriptors rate is #{avg_fd}, which is more than #{config[:fd_critical]} threshold)
Expand Down
2 changes: 1 addition & 1 deletion bin/check-zookeeper-latency.rb
Original file line number Diff line number Diff line change
Expand Up @@ -67,7 +67,7 @@ def run
end

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

ok %(Zookeeper has average latency #{avg_latency}) if avg_latency < config[:avg_latency_critical]
critical %(Zookeeper's average latency is #{avg_latency}, which is more than #{config[:avg_latency_critical]} threshold)
Expand Down
2 changes: 1 addition & 1 deletion bin/check-zookeeper-reqs.rb
Original file line number Diff line number Diff line change
Expand Up @@ -70,7 +70,7 @@ def run
end

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

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

0 comments on commit 688c3fb

Please sign in to comment.