Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Alert if there are any outstanding partition transfers #92

Merged
merged 1 commit into from
Dec 23, 2014
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
35 changes: 32 additions & 3 deletions bin/riemann-riak
Original file line number Diff line number Diff line change
Expand Up @@ -27,8 +27,8 @@ class Riemann::Tools::Riak

def initialize
detect_features
@httpstatus = true

@httpstatus = true
# What's going on here? --aphyr
if
begin
Expand Down Expand Up @@ -59,7 +59,7 @@ class Riemann::Tools::Riak
def detect_features
@escript = true # Whether escript is present on this machine
@riakadmin = true # Whether riak-admin is present

if `which escript` =~ /^\s*$/
@escript = false
end
Expand Down Expand Up @@ -113,6 +113,34 @@ class Riemann::Tools::Riak
end
end

def check_transfers
str = if @riakadmin
`riak-admin transfers`
else
nil
end

return if str.nil?

if str =~ /'#{opts[:node_name]}' waiting to handoff (\d+) partitions/
report(
:host => opts[:riak_host],
:service => 'riak transfers',
:state => 'critical',
:metric => $1.to_i,
:description => "waiting to handoff #{$1} partitions"
)
else
report(
:host => opts[:riak_host],
:service => 'riak transfers',
:state => 'ok',
:metric => 0,
:description => "No pending transfers"
)
end
end

def check_disk
gb = `du -Ls #{opts[:data_dir]}`.split(/\s+/).first.to_i / (1024.0**2)
report(
Expand Down Expand Up @@ -294,6 +322,7 @@ class Riemann::Tools::Riak
check_stats
check_ring
check_disk
check_transfers
end
end

Expand Down