From: Ahmed R. <ar...@ta...> - 2007-05-30 16:39:39
|
Hi there, I am experiencing strange results while using the 'ping' monitor in the 'status' module. This is happening on Fedora Core 3, but I had such trouble on previous versions of FedoraCore/RedHat. Current perl version is 5.8.5. For still unexplained reason, some ping monitors fail on perfectly working hosts (using dns entries or ip addresses doesn't change the result). There are 3 ways to ping a remote host with this module : - builtin command - linux/freebsd command - other I tried both builtin & linux/freebsd and got bad but different results. The last option permits the use of a custom command line, that works. After reading the code in '/usr/libexec/webmin/status/ping-monitor.pl', I found out that the 2nd option uses the command "ping -c 1 -t 1". This, after reading my man page, tells me that "-t 1" will set a "ttl" to "1", meaning that using ping to any host beyond my first router will fail (routers decrement ttl by 1 at every hop). Reading the openbsd man page at http://www.freebsd.org/cgi/man.cgi?query=ping&sektion=8&apropos=0&manpath=FreeBSD+4.3-RELEASE however says that '-t' means "timeout" and not "ttl" as on linux. The same result on linux needs the '-w' switch instead. Therefore I made a slight change to the code (as I am running linux), and now the line "ping -c 1 -t 1" : $config{'pinger'}; says "ping -c 1 -w $wait" : $config{'pinger'}; note that $wait is a variable that can be set to the number of seconds that ping will wait for before aborting. This wasn't taken care of before, but set by the script as it is a field in the webmin form. I am unable to say if the perl code (use Socket;) that seems to build up the icmp packet "from scratch" has an error, but it seems to get me to false results. Thanks in advance for any input, Ahmed RAHAL. |