-
Notifications
You must be signed in to change notification settings - Fork 26
Description
hi,
I'm trying to use the LIBRARY to issue commands on a series of switches, but I don't know Ruby.
I tried several writes like the following one. The script found 27 switches but the command is only executed on the first switch !
#!/usr/bin/env ruby
require 'oxidized/script'
Oxidized::Config.load
Oxidized.setup_logger
Oxidized::Script.new(:ostype=>'cisco', :verbose=>true) do |oxs|
puts oxs.cmd 'show running-config view full | inc hostname'
end
oxidized@ct-oxid:~$ ./ruby1.cmd
I, [2024-02-08T18:30:25.407738 #3685] INFO -- : lib/oxidized/nodes.rb: Loading nodes
I, [2024-02-08T18:30:25.506940 #3685] INFO -- : lib/oxidized/nodes.rb: Loaded 27 nodes
HOST -
OXS - show running-config view full | inc hostname
hostname BRIO-DCC761
I dont understand which option i can use. In the script.rb, the constructor is defined like that :
# @param [Hash] opts options for Oxidized::Script
# @option opts [String] :host @hostname or ip address for Oxidized::Node
# @option opts [String] :model node model (ios, junos etc) if defined, nodes are not loaded from source
# @option opts [String] :ostype OS Type (ios, junos, etc)
# @option opts [Fixnum] :timeout oxidized timeout
# @option opts [String] :username username for login
# @option opts [String] :passsword password for login
# @option opts [String] :enable enable password to use
# @option opts [String] :community community to use for discovery
# @option opts [String] :protocols protocols to use to connect, default "ssh ,telnet"
# @option opts [boolean] :verbose extra output, e.g. show command given in output
# @yieldreturn [self] if called in block, returns self and disconnnects session after exiting block
# @return [void]
def initialize opts, &block
@host = opts.delete :host
model = opts.delete :model
ostype = opts.delete :ostype
timeout = opts.delete :timeout
username = opts.delete :username
password = opts.delete :password
enable = opts.delete :enable
community = opts.delete :community
group = opts.delete :group
@verbose = opts.delete :verbose
Any help would be welcome :-)
GE