Fibre Channel (SAN)

Reply
N/A
kfoley
Posts: 1
Registered: ‎01-08-2013

Can I run commands like switchshow on a brocade 5100 and redirect output and scp output to remote host

I am trying to send the output from our brocade switches to a remote host. I want to be able to write scripts that will use awk, sed, grep etc to filter out information. Maybe I can scp to the brocade switch from a remote unix host and run commands but I would need to have an authorized_hosts and allow remote logins configured on the brocade. Is any of this possible?

Contributor
sebastian.thaele
Posts: 60
Registered: ‎05-26-2009

Re: Can I run commands like switchshow on a brocade 5100 and redirect output and scp output to remote host

I'm not sure if I understood what you want to do... If I would like to do that I would simply log in via root. There you have most of the little helpers from the underlying Linux.

Frequent Contributor
alexey.stepanov
Posts: 119
Registered: ‎03-20-2011

Re: Can I run commands like switchshow on a brocade 5100 and redirect output and scp output to remote host

hi! maybe you meant "ssh" (not "scp")? you might also try "expect", it's ugly but it works :smileysurprised:)

Occasional Contributor
richkell
Posts: 20
Registered: ‎09-11-2012

Re: Can I run commands like switchshow on a brocade 5100 and redirect output and scp output to remote host

From within FOS, is there anything available similar to the following:

uptime > c:\testing\uptime.txt (to create)

uptime >> c:\testing\uptime.txt (to append)

I have several commands I'd like to run and output to individual files.

Occasional Contributor
richkell
Posts: 20
Registered: ‎09-11-2012

Re: Can I run commands like switchshow on a brocade 5100 and redirect output and scp output to remote host

This is what is displayed when attempted

switch1:FID128:admin> uptime > c:\healthcheck\uptime.txt

rbash: c:healthcheckuptime.txt: restricted: cannot redirect output

switch1:FID128:admin>

Frequent Contributor
alexey.stepanov
Posts: 119
Registered: ‎03-20-2011

Re: Can I run commands like switchshow on a brocade 5100 and redirect output and scp output to remote host

hi,

two reasons for what you see:

1) that's linux, so things like c:\ do not exist there

2) that's rbash - Restricted shell - Wikipedia, the free encyclopedia

to use redirection right inside the switch prompt, you have to be root.

alternatively, you can use on your workstation something like:

ssh admin@your_switch_name_or_ipaddress uptime >> uptime.txt

this will create uptime.txt - on your workstation.

hth!

Occasional Contributor
richkell
Posts: 20
Registered: ‎09-11-2012

Re: Can I run commands like switchshow on a brocade 5100 and redirect output and scp output to remote host

Well that answers a portion of my question. The problem is, is that I am creating custom scripts for automation of 6 or 7 commands with custom save files for each command to run daily, so this wont work.

I am using Putty accessed through a spreadsheet with hundreds of devices. Simple macros call each device and start the command process with pointers to hostname, date, time, and command.txt files as output.

It's been a while since I've puttied into a linux box from a windows system, but I could swear I could redirect the output to my windows system...

Frequent Contributor
alexey.stepanov
Posts: 119
Registered: ‎03-20-2011

Re: Can I run commands like switchshow on a brocade 5100 and redirect output and scp output to remote host

maybe that was - putty -> session -> logging ?

Occasional Contributor
richkell
Posts: 20
Registered: ‎09-11-2012

Re: Can I run commands like switchshow on a brocade 5100 and redirect output and scp output to remote host

That defeats the point of automation unfortunately.

Occasional Contributor
rico
Posts: 6
Registered: ‎07-10-2012

Re: Can I run commands like switchshow on a brocade 5100 and redirect output and scp output to remote host

hi,

In order to redirect the output to a text file you need plink:

http://www.chiark.greenend.org.uk/~sgtatham/putty/download.html

Then you need to either add the directory where you have saved plink to the path in your environment variables or just go to the right directory.

With plink you can execute ssh commands in batch mode.

For switchshow it would like that:

plink.exe -ssh -pw password user@switch switchshow > c:\brocade\switchshow.txt

cheers,

Rico

Join the Community

Get quick and easy access to valuable resource designed to help you manage your Brocade Network.