ExtremeCloud IQ- Site Engine & Extreme Management Center

Expand all | Collapse all

XMC TCL scripting, how to wait xx minutes between CLI commands?

Rahman Duran

Rahman Duran10-05-2018 09:07

StephanH

StephanH10-05-2018 09:07

  • 1.  XMC TCL scripting, how to wait xx minutes between CLI commands?

    Posted 10-03-2018 09:07
    Hi,

    As our Palo Alto firewall device has no scheduled update feature, I want to use XMC scripting for this purpose.

    # request system software install version
    # request restart system

    These are the commands. So how can I tell XMC TCL engine to wait 30 minutes between these two commands?

    Regards,
    Rahman


  • 2.  RE: XMC TCL scripting, how to wait xx minutes between CLI commands?

    Posted 10-03-2018 11:06
    Hello Rahman,

    never used but there is a special "sleep" command in XMC.
    Open your onlinehelp of XMC and search for "How to create scrips" for more details.
    On this page look for "sleep"

    Have fun.

    Best regards
    Stephan


  • 3.  RE: XMC TCL scripting, how to wait xx minutes between CLI commands?

    Posted 10-03-2018 11:06
    Hello Rahman,
    if the "sleep" command isn't working within an TCL script you can use the following TLC build in command:

    after


  • 4.  RE: XMC TCL scripting, how to wait xx minutes between CLI commands?

    Posted 10-03-2018 11:06
    Hello Stephan,

    Yes, I tried and "sleep xxx" works. But my script is not working.

    #@MetaDataStart
    #############################################################################################
    # Define your user parameters in this section. For reference, see bundled scripts.
    #############################################################################################

    #@VariableFieldLabel "Version"
    set var version 8.x.x
    #@MetaDataEnd

    # Enter all CLI commands from here
    CLI request system software install version $version
    CLI y
    sleep 45
    CLI show system info

    Here is what I get when I run the script:

    EMC User: rduran
    EMC User Domain: artvin.edu.tr
    CLI Login: admin
    ACU-PA-3050-1 10.100.2.100 10/05/2018 01:43:04 PM at 01:43:04 PM
    Error: session exceeded timeout: 30 secs
    Error: session exceeded timeout: 30 secs
    ACU-PA-3050-1 #sleep 45
    Error: session exceeded timeout: 30 secs

    If I don't use "CLI" keyword I get this error:

    javax.script.ScriptException:
    *** Script Error ***
    nul

    So how can I run those to commands against PANOS ssh CLI?

    Regards,

    Rahman 


  • 5.  RE: XMC TCL scripting, how to wait xx minutes between CLI commands?

    Posted 10-05-2018 09:07
    The error "session exceeded timeout: 30 secs" might indicate that the script engine expects some "regular" activity on your SSH session. So if you sleep for 45 seconds, there is no activity and the engine thinks that something is wrong and breaks processing (my interpretation 😉 ).

    One idea: try to leep for 20 seconds, execute some CLI command (show system info), sleep another 25 seconds and then continue with your commands.


  • 6.  RE: XMC TCL scripting, how to wait xx minutes between CLI commands?

    Posted 10-05-2018 09:07
    But the first command of the script is "CLI request system software install version $version" and it is not run. For testing I deleted the "sleep" line and the result is same:

    EMC User: rduran
    EMC User Domain: artvin.edu.tr
    CLI Login: admin
    ACU-PA-3050-1 10.100.2.100 10/05/2018 02:11:20 PM at 02:11:20 PM
    Error: session exceeded timeout: 30 secs
    Error: session exceeded timeout: 30 secs
    Error: session exceeded timeout: 30 secs

    Regards,
    Rahman


  • 7.  RE: XMC TCL scripting, how to wait xx minutes between CLI commands?

    Posted 10-05-2018 09:07
    How long does it take to execute this command when you try to do it manually? Longer than 30 seconds?


  • 8.  RE: XMC TCL scripting, how to wait xx minutes between CLI commands?

    Posted 10-05-2018 09:07
    No it runs instantly. First command ask for "Yes/No". After I press "y" it just prints the PANOS job id and returns to console immediately.


  • 9.  RE: XMC TCL scripting, how to wait xx minutes between CLI commands?

    Posted 10-05-2018 09:07
    Hello Rahman,

    is this timer long enough?




  • 10.  RE: XMC TCL scripting, how to wait xx minutes between CLI commands?

    Posted 10-05-2018 09:07
    maybe the script executes the required "y" too fast? can you have it sleep 3 seconds between your two CLI commands (just before you execute CLI y)... just a wild guess..


  • 11.  RE: XMC TCL scripting, how to wait xx minutes between CLI commands?

    Posted 10-05-2018 09:07
    @SH, yes I set it 3600 secs.


  • 12.  RE: XMC TCL scripting, how to wait xx minutes between CLI commands?

    Posted 10-05-2018 09:07
    Kurt, I will try what you suggest but, shouldn't I see the all CLI output, "Yes/no" question?


  • 13.  RE: XMC TCL scripting, how to wait xx minutes between CLI commands?

    Posted 10-05-2018 09:07
    My idea was to try something like this:

    CLI request system software install version $version
    sleep 3

    CLI y
    sleep 45

    CLI show system info


  • 14.  RE: XMC TCL scripting, how to wait xx minutes between CLI commands?

    Posted 10-05-2018 09:07
    No luck:

    EMC User: rduran
    EMC User Domain: artvin.edu.tr
    CLI Login: admin
    ACU-PA-3050-1 10.100.2.100 10/05/2018 02:43:22 PM at 02:43:22 PM
    Error: session exceeded timeout: 30 secs
    ACU-PA-3050-1 #sleep 10
    Error: session exceeded timeout: 30 secs
    Error: session exceeded timeout: 30 secs

    What I mean is, after XMC scripting engine login to device, will it show all command outputs in "Results" section of "XMC script run" page? Because when I login via putty, I see two information lines:

    Using username "admin".
    Using keyboard-interactive authentication.
    Password:
    Last login: Fri Oct 5 14:43:24 2018 from 192.168.10.199

    Number of failed attempts since last successful login: 0

    admin@ACU-PA-3050-1>

    But I don't see this in "results" section of XMC.


  • 15.  RE: XMC TCL scripting, how to wait xx minutes between CLI commands?

    Posted 10-05-2018 09:07
    Hello Rahman,

    have a look to these article:

    https://gtacknowledge.extremenetworks.com/articles/Solution/Running-an-XMC-Script-on-8-1-4-40-takes-...

    Look's like your error message.

    Best regards
    Stephan



  • 16.  RE: XMC TCL scripting, how to wait xx minutes between CLI commands?

    Posted 10-05-2018 09:07
    Hello Stephan,

    It seems the link in GTAC KB is protected. I can not download it.

    Regards,

    Rahman


  • 17.  RE: XMC TCL scripting, how to wait xx minutes between CLI commands?

    Posted 10-05-2018 09:07
    Hello,

    maybe Kurt has access?

    Or you can open a case with reference to this GTAC article.

    Best regards
    Stephan


  • 18.  RE: XMC TCL scripting, how to wait xx minutes between CLI commands?

    Posted 10-05-2018 09:07
    I also don't have access - I just applied to get access - once I got it, I will provide you with the file. Can you send me an email: kurt [dot] semba [@] extremenetworks [dot] com



  • 19.  RE: XMC TCL scripting, how to wait xx minutes between CLI commands?

    Posted 10-05-2018 09:07
    Hello Rahman,

    did the KB article help?

    Best regards
    Stephan


  • 20.  RE: XMC TCL scripting, how to wait xx minutes between CLI commands?

    Posted 10-05-2018 09:07
    Hello Stephan, No, I could not access the file on the kb, Kurt also did not provide the file yet. Regards, Rahman


  • 21.  RE: XMC TCL scripting, how to wait xx minutes between CLI commands?



  • 22.  RE: XMC TCL scripting, how to wait xx minutes between CLI commands?

    Posted 10-05-2018 09:07
    Hello Ryan,

    links works fine.


  • 23.  RE: XMC TCL scripting, how to wait xx minutes between CLI commands?

    Posted 10-05-2018 09:07
    Hello Ryan,

    I loaded the file but it did not solve the issue. Our new support contract is on the way. When it is active I will open a bunch of cases with GTAC.


  • 24.  RE: XMC TCL scripting, how to wait xx minutes between CLI commands?

    Posted 10-05-2018 09:07
    Hello Ryan,

    I loaded the file but it did not solve the issue. Our new support contract is on the way. When it is active I will open a bunch of cases with GTAC.