Brocade Fibre Channel Networking Community

Expand all | Collapse all

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

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

    Posted 01-08-2013 02:45 AM

    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?


    #BrocadeFibreChannelNetworkingCommunity


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

    Posted 01-08-2013 03:31 PM

    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.


    #BrocadeFibreChannelNetworkingCommunity


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

    Posted 01-14-2013 04:23 AM

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


    #BrocadeFibreChannelNetworkingCommunity


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

    Posted 02-19-2013 06:44 AM

    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.


    #BrocadeFibreChannelNetworkingCommunity


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

    Posted 02-19-2013 06:49 AM

    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>


    #BrocadeFibreChannelNetworkingCommunity


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

    Posted 02-19-2013 07:31 AM

    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!


    #BrocadeFibreChannelNetworkingCommunity


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

    Posted 02-19-2013 07:39 AM

    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...


    #BrocadeFibreChannelNetworkingCommunity


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

    Posted 02-20-2013 02:11 AM

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


    #BrocadeFibreChannelNetworkingCommunity


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

    Posted 02-20-2013 06:12 AM

    That defeats the point of automation unfortunately.


    #BrocadeFibreChannelNetworkingCommunity


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

    Posted 02-21-2013 01:33 PM

    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


    #BrocadeFibreChannelNetworkingCommunity


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

    Posted 02-25-2013 05:43 AM

    Hi Rico,

    Thanks, but I've already tried plink. There are several issues with using plink with a macro.

    #1 is bringing the DOS prompt into focus using AppActivate. It simply doesn't work.

    #2 is creating custom save files.


    #BrocadeFibreChannelNetworkingCommunity