I've created the following ruby script that telnet to Cisco devices, that telnet to Cisco devices and run command 'show int status err'.
require 'net/telnet'
C3550_20_PterraEst = "192.168.244.20" #Enter the IP address here
USER = "user" #Enter username here
PASS = "password" #Enter password here
ENABLE = "password" #Enter enable password here
print "Selezionare il piano [0-1-2-All]: ";
# get the input from the console,
val1 = gets;
tn = Net::Telnet::new("Host" => C3550_20_PterraEst,
"Timeout" => 5,
"Prompt" => /Username/ )
tn.cmd("\n#{USER}")
tn.cmd(PASS)
tn.cmd("sh int status err\n") { |c| print c }
exit
Now I want that those Cisco devices output (when I send 'show int status err') should be assigned to a variables inside my script...I explain better:
suppose that command 'show int status err' returns this value:
Int fa0/20 Int fa0/25
I want do something such as... variable1 = 'Int fa0/20,Int fa0/25' and later use variable1 inside my script.
In witch way can I do?