Skip to content

Commit

Permalink
Add support for sensor reading
Browse files Browse the repository at this point in the history
  • Loading branch information
defect committed Mar 1, 2016
1 parent 66b8b58 commit 7132a21
Show file tree
Hide file tree
Showing 5 changed files with 12 additions and 1 deletion.
1 change: 1 addition & 0 deletions support/ruby/consolr/bin/consolr
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,7 @@ opt_parser = OptionParser.new do |opt|
opt.on('-x', '--off', 'turn off node') { options[:off] = true }
opt.on('-X', '--soft-off', 'turn off gracefully (via ACPI)') { options[:soft_off] = true }
opt.on('-S', '--status', 'print asset power status') { options[:status] = true }
opt.on('-L', '--sensors', 'print list of sensor values') { options[:sensors] = true }
opt.on('--runner RUNNER', 'specify the runner to use') { |runner| options[:runner] = runner }

opt.on_tail('-h', '--help', 'help') { puts opt; exit 0 }
Expand Down
2 changes: 2 additions & 0 deletions support/ruby/consolr/lib/consolr.rb
Original file line number Diff line number Diff line change
Expand Up @@ -155,6 +155,8 @@ def start options
puts runner.soft_reboot @node
when options[:status]
puts runner.status @node
when options[:sensors]
puts runner.sensors @node
else
begin
puts "specify an action"
Expand Down
4 changes: 4 additions & 0 deletions support/ruby/consolr/lib/consolr/runners/ipmitool.rb
Original file line number Diff line number Diff line change
Expand Up @@ -71,6 +71,10 @@ def status node
cmd 'power status', node
end

def sensors node
cmd 'sensor list', node
end

private
def cmd action, node
system("#{@ipmitool} -I lanplus -H #{node.ipmi.address} -U #{node.ipmi.username} -P #{node.ipmi.password} #{action}")
Expand Down
4 changes: 4 additions & 0 deletions support/ruby/consolr/lib/consolr/runners/runner.rb
Original file line number Diff line number Diff line change
Expand Up @@ -58,6 +58,10 @@ def soft_reboot node
def status node
raise 'status is not implemented for this runner'
end

def sensors node
raise 'sensors is not implemented for this runner'
end
end
end
end
Expand Down
2 changes: 1 addition & 1 deletion support/ruby/consolr/lib/consolr/version.rb
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
module Consolr
VERSION = "1.1.0"
VERSION = "1.1.1"
end

0 comments on commit 7132a21

Please sign in to comment.