summaryrefslogtreecommitdiff
path: root/lib/oxidized/input
diff options
context:
space:
mode:
authorSaku Ytti <saku@ytti.fi>2016-10-31 17:54:47 +0200
committerSaku Ytti <saku@ytti.fi>2016-10-31 17:54:47 +0200
commit98ee2d2fadd56b9efadfc4f9ff667f71f6b22f6c (patch)
treef29af7273b01e8338c55a0d291bd644b97cf05f5 /lib/oxidized/input
parent0c307da5dfd5c7fa4dfa156694c619ab3b3fa0d3 (diff)
Allow model to specify SSH PTY options
Diffstat (limited to 'lib/oxidized/input')
-rw-r--r--lib/oxidized/input/ssh.rb11
1 files changed, 8 insertions, 3 deletions
diff --git a/lib/oxidized/input/ssh.rb b/lib/oxidized/input/ssh.rb
index 15f1427..30b481d 100644
--- a/lib/oxidized/input/ssh.rb
+++ b/lib/oxidized/input/ssh.rb
@@ -17,8 +17,9 @@ module Oxidized
class NoShell < OxidizedError; end
def connect node
- @node = node
- @output = ''
+ @node = node
+ @output = ''
+ @pty_options = { term: "vt100" }
@node.model.cfg['ssh'].each { |cb| instance_exec(&cb) }
secure = Oxidized.config.input.ssh.secure
@log = File.open(Oxidized::Config::Log + "/#{@node.ip}-ssh", 'w') if Oxidized.config.input.debug?
@@ -74,6 +75,10 @@ module Oxidized
private
+ def pty_options hash
+ @pty_options = @pty_options.merge hash
+ end
+
def disconnect
disconnect_cli
# if disconnect does not disconnect us, give up after timeout
@@ -94,7 +99,7 @@ module Oxidized
@output << data
@output = @node.model.expects @output
end
- ch.request_pty (_opts={:term=>'vt100'}) do |_ch, success_pty|
+ ch.request_pty (@pty_options) do |_ch, success_pty|
raise NoShell, "Can't get PTY" unless success_pty
ch.send_channel_request 'shell' do |_ch, success_shell|
raise NoShell, "Can't get shell" unless success_shell