How can I modify the tftp timeout?
Options
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Get Direct Link
- Report Inappropriate Content
‎05-02-2016 05:00 PM
I'd like to test if a tFTP server is up and if it's up I'm downloading some scripts on to the switch. Right now I'm trying to download a dummy file from the tFTP server using this command
tftp get serverIP dummyFile.xsf
if the tftp server is up, I get a reply very fast that the file is not available. But if the server is down the timeout for the tftp command is 60 seconds. It is very long in my application. I'd like to decrease it to 5-6 seconds. Is this possible?
Is there any other method to find out if the server is up or not?
EDIT:
BTW, I've tried to ping the tFTP server but even when it's up I get this errPacket transmit error: Packet transmit error; Destination unreachable
tftp get serverIP dummyFile.xsf
if the tftp server is up, I get a reply very fast that the file is not available. But if the server is down the timeout for the tftp command is 60 seconds. It is very long in my application. I'd like to decrease it to 5-6 seconds. Is this possible?
Is there any other method to find out if the server is up or not?
EDIT:
BTW, I've tried to ping the tFTP server but even when it's up I get this errPacket transmit error: Packet transmit error; Destination unreachable
6 REPLIES 6
Options
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Get Direct Link
- Report Inappropriate Content
‎05-03-2016 01:01 AM
Can I ask why you are doing this from a switch and not a server? It seems to me that it is much easier to write a script to test your tftp server and then send out notification (syslog/email) if the tftp server fails and put it on a cronjob. Or even use nmap/nping or udpping to verify that your tftp server is up. that way you don't actually have to transfer any files.
Options
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Get Direct Link
- Report Inappropriate Content
‎05-02-2016 06:25 PM
Hi Ali, currently there is no native CLI option to modify the TFTP timeout.
An option would be creating a Python script to ping the server through MGMT vlan and only start the TFTP process if the server is up.
However this script might need to be created from scratch.
You can find some examples for Python scripts in the link below:
EXOS Python Scripts
Note: Python version 2.7.3 has been integrated into EXOS since EXOS 15.6.1
An option would be creating a Python script to ping the server through MGMT vlan and only start the TFTP process if the server is up.
However this script might need to be created from scratch.
You can find some examples for Python scripts in the link below:
EXOS Python Scripts
Note: Python version 2.7.3 has been integrated into EXOS since EXOS 15.6.1
Options
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Get Direct Link
- Report Inappropriate Content
‎05-02-2016 06:25 PM
Using python you could use expect and the timeout option so it will fail if the command is not finished within that timeout.
Something like below but then you need to extend that a bit.
import pexpectimport exshexpect
exosPrompt = ' # '
Create an expect object. Pass in the prompt and the back end function to call:
p = exshexpect.exshspawn(exosPrompt, exsh.clicmd)
Use sendline to send commands to the backend function (in this case exsh.clicmd) :
p.sendline('tftp get') <-
idx = p.expect([exosPrompt, pexpect.EOF, pexpect.TIMEOUT])
Something like below but then you need to extend that a bit.
import pexpectimport exshexpect
exosPrompt = ' # '
Create an expect object. Pass in the prompt and the back end function to call:
p = exshexpect.exshspawn(exosPrompt, exsh.clicmd)
Use sendline to send commands to the backend function (in this case exsh.clicmd) :
p.sendline('tftp get
idx = p.expect([exosPrompt, pexpect.EOF, pexpect.TIMEOUT])
Options
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Get Direct Link
- Report Inappropriate Content
‎05-02-2016 06:25 PM
Hi Henrique, thanks for your comment. I can write the python script but as I've explained to@Brandon my tFTP server is running on a Windows machine so if I ping the tFTP server and even if the server is not running I will get a reply to my ping requests, so ping is not useful in my case.