Skip to content

Commit

Permalink
sunos cpu info
Browse files Browse the repository at this point in the history
  • Loading branch information
aterreno committed Dec 19, 2013
1 parent 2d98d3a commit 002c285
Showing 1 changed file with 31 additions and 0 deletions.
31 changes: 31 additions & 0 deletions bin/riemann-health
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,11 @@ class Riemann::Tools::Health
@disk = method :disk
@load = method :freebsd_load
@memory = method :freebsd_memory
when 'sunos'
@cores = `psrinfo -p`.to_i
@cpu = method :sunos_cpu
@disk = :sunos_disk
@memory = :sunos_memory
else
@cores = cores
puts "WARNING: OS '#{ostype}' not explicitly supported. Falling back to Linux" unless ostype == "linux"
Expand Down Expand Up @@ -251,6 +256,32 @@ class Riemann::Tools::Health
end
end

def sunos_cpu
values = {}
lines = IO.popen('sm-cpuinfo -p 2>&1') do |child|
child.read.split("\n")
end

puts lines

lines.each do |line|
cols = line.strip.split(":")
values[cols[0]] = cols[1]
end
puts values
values
end


def sunos_memory
end

def sunos_load
end

def sunos_disk
end

def tick
if @cpu_enabled
@cpu.call
Expand Down

0 comments on commit 002c285

Please sign in to comment.