Forum Discussion

Jos_Andel_46371's avatar
Jos_Andel_46371
Icon for Nimbostratus rankNimbostratus
Feb 04, 2008

Trying to health check TFTP-servers

Hi,

 

 

Since we're loadbalancing some TFTP-servers I'm trying to create a healthcheck for TFTP-servers. What I'm trying to do is:

 

- get a file

 

- check the checksum of the retrieved file

 

 

I've made a perl-script which uses the Net::TFTP module.

 

 

------------------------

 

 

!/usr/bin/perl -w

 

 

 

use strict;

 

use Net::TFTP;

 

require 5.005;

 

 

collect commandline arguments

 

my $node = shift;

 

my $port = shift;

 

 

set filename to get and to save

 

my $remotefile = 'pcx3k_eu_6_24_18.img';

 

my $localfile = 'pcx3k_eu_6_24_18.img';

 

 

connect to the node and tftp-get the file

 

my $tftp = Net::TFTP->new($node,Retries => 2);

 

$tftp->get("$remotefile","$localfile");

 

my $err = $tftp->error;

 

If tftp reports an error exit with code 1

 

if ($err) {

 

exit(1);

 

}

 

 

If there was no error exit with code 0

 

exit(0);

 

 

---------------------------

 

 

When I run it my Big-IP nicely does the request to the targetet TFTP-server, and that server sends the first datapacket.

 

 

--- tcpdump output ---

 

08:36:22.456892 IP 10.200.220.12.33063 > 10.200.220.3.69: 32 RRQ "pcx3k_eu_6_24_18.img" netascii

 

08:36:22.457886 IP 10.200.220.3.4410 > 10.200.220.12.33063: UDP, length 516

 

---

 

 

This datapacket never arrives at my perl script, even though my perl-script seems to listen for them:

 

--- netstat -an output ---

 

udp 0 0 0.0.0.0:33063 0.0.0.0:* 17874/perl

 

---

 

 

When the first datapacket never arrives in perl, it will never send a 4-byte ack packet. And then the server decides there is a timeout and cancels sending the file.

 

 

Curious is that:

 

- When I use the same script on a regular linux-machine it works like a charm

 

- When I use a regular linux tftp-client on my Big-IP I see the same effects.

 

 

Anyone having an idea what the problem is and how to solve it?

 

 

Bye, Jos

1 Reply

  • Hi! I'm trying to use this perl-script but I allways get this error when try to run it: 'Can't locate Net/TFTP.pm in @INC ...'. Probably a basic mistake but can't seem to get it to work. I'm running version 11.3.0. Also can you explain on how to apply this script to a monitor? Thanks in advance for your help, João