mrtg-ping-probe-2.2.0/0000755000372000353120000000000007730660070010272 5mrtg-ping-probe-2.2.0/COPYING0000444000372000353120000004307006173464055011254 GNU GENERAL PUBLIC LICENSE Version 2, June 1991 Copyright (C) 1989, 1991 Free Software Foundation, Inc. 675 Mass Ave, Cambridge, MA 02139, USA Everyone is permitted to copy and distribute verbatim copies of this license document, but changing it is not allowed. Preamble The licenses for most software are designed to take away your freedom to share and change it. By contrast, the GNU General Public License is intended to guarantee your freedom to share and change free software--to make sure the software is free for all its users. This General Public License applies to most of the Free Software Foundation's software and to any other program whose authors commit to using it. (Some other Free Software Foundation software is covered by the GNU Library General Public License instead.) You can apply it to your programs, too. When we speak of free software, we are referring to freedom, not price. Our General Public Licenses are designed to make sure that you have the freedom to distribute copies of free software (and charge for this service if you wish), that you receive source code or can get it if you want it, that you can change the software or use pieces of it in new free programs; and that you know you can do these things. To protect your rights, we need to make restrictions that forbid anyone to deny you these rights or to ask you to surrender the rights. These restrictions translate to certain responsibilities for you if you distribute copies of the software, or if you modify it. For example, if you distribute copies of such a program, whether gratis or for a fee, you must give the recipients all the rights that you have. You must make sure that they, too, receive or can get the source code. And you must show them these terms so they know their rights. We protect your rights with two steps: (1) copyright the software, and (2) offer you this license which gives you legal permission to copy, distribute and/or modify the software. Also, for each author's protection and ours, we want to make certain that everyone understands that there is no warranty for this free software. If the software is modified by someone else and passed on, we want its recipients to know that what they have is not the original, so that any problems introduced by others will not reflect on the original authors' reputations. Finally, any free program is threatened constantly by software patents. We wish to avoid the danger that redistributors of a free program will individually obtain patent licenses, in effect making the program proprietary. To prevent this, we have made it clear that any patent must be licensed for everyone's free use or not licensed at all. The precise terms and conditions for copying, distribution and modification follow. GNU GENERAL PUBLIC LICENSE TERMS AND CONDITIONS FOR COPYING, DISTRIBUTION AND MODIFICATION 0. This License applies to any program or other work which contains a notice placed by the copyright holder saying it may be distributed under the terms of this General Public License. The "Program", below, refers to any such program or work, and a "work based on the Program" means either the Program or any derivative work under copyright law: that is to say, a work containing the Program or a portion of it, either verbatim or with modifications and/or translated into another language. (Hereinafter, translation is included without limitation in the term "modification".) Each licensee is addressed as "you". Activities other than copying, distribution and modification are not covered by this License; they are outside its scope. The act of running the Program is not restricted, and the output from the Program is covered only if its contents constitute a work based on the Program (independent of having been made by running the Program). Whether that is true depends on what the Program does. 1. You may copy and distribute verbatim copies of the Program's source code as you receive it, in any medium, provided that you conspicuously and appropriately publish on each copy an appropriate copyright notice and disclaimer of warranty; keep intact all the notices that refer to this License and to the absence of any warranty; and give any other recipients of the Program a copy of this License along with the Program. You may charge a fee for the physical act of transferring a copy, and you may at your option offer warranty protection in exchange for a fee. 2. You may modify your copy or copies of the Program or any portion of it, thus forming a work based on the Program, and copy and distribute such modifications or work under the terms of Section 1 above, provided that you also meet all of these conditions: a) You must cause the modified files to carry prominent notices stating that you changed the files and the date of any change. b) You must cause any work that you distribute or publish, that in whole or in part contains or is derived from the Program or any part thereof, to be licensed as a whole at no charge to all third parties under the terms of this License. c) If the modified program normally reads commands interactively when run, you must cause it, when started running for such interactive use in the most ordinary way, to print or display an announcement including an appropriate copyright notice and a notice that there is no warranty (or else, saying that you provide a warranty) and that users may redistribute the program under these conditions, and telling the user how to view a copy of this License. (Exception: if the Program itself is interactive but does not normally print such an announcement, your work based on the Program is not required to print an announcement.) These requirements apply to the modified work as a whole. If identifiable sections of that work are not derived from the Program, and can be reasonably considered independent and separate works in themselves, then this License, and its terms, do not apply to those sections when you distribute them as separate works. But when you distribute the same sections as part of a whole which is a work based on the Program, the distribution of the whole must be on the terms of this License, whose permissions for other licensees extend to the entire whole, and thus to each and every part regardless of who wrote it. Thus, it is not the intent of this section to claim rights or contest your rights to work written entirely by you; rather, the intent is to exercise the right to control the distribution of derivative or collective works based on the Program. In addition, mere aggregation of another work not based on the Program with the Program (or with a work based on the Program) on a volume of a storage or distribution medium does not bring the other work under the scope of this License. 3. You may copy and distribute the Program (or a work based on it, under Section 2) in object code or executable form under the terms of Sections 1 and 2 above provided that you also do one of the following: a) Accompany it with the complete corresponding machine-readable source code, which must be distributed under the terms of Sections 1 and 2 above on a medium customarily used for software interchange; or, b) Accompany it with a written offer, valid for at least three years, to give any third party, for a charge no more than your cost of physically performing source distribution, a complete machine-readable copy of the corresponding source code, to be distributed under the terms of Sections 1 and 2 above on a medium customarily used for software interchange; or, c) Accompany it with the information you received as to the offer to distribute corresponding source code. (This alternative is allowed only for noncommercial distribution and only if you received the program in object code or executable form with such an offer, in accord with Subsection b above.) The source code for a work means the preferred form of the work for making modifications to it. For an executable work, complete source code means all the source code for all modules it contains, plus any associated interface definition files, plus the scripts used to control compilation and installation of the executable. However, as a special exception, the source code distributed need not include anything that is normally distributed (in either source or binary form) with the major components (compiler, kernel, and so on) of the operating system on which the executable runs, unless that component itself accompanies the executable. If distribution of executable or object code is made by offering access to copy from a designated place, then offering equivalent access to copy the source code from the same place counts as distribution of the source code, even though third parties are not compelled to copy the source along with the object code. 4. You may not copy, modify, sublicense, or distribute the Program except as expressly provided under this License. Any attempt otherwise to copy, modify, sublicense or distribute the Program is void, and will automatically terminate your rights under this License. However, parties who have received copies, or rights, from you under this License will not have their licenses terminated so long as such parties remain in full compliance. 5. You are not required to accept this License, since you have not signed it. However, nothing else grants you permission to modify or distribute the Program or its derivative works. These actions are prohibited by law if you do not accept this License. Therefore, by modifying or distributing the Program (or any work based on the Program), you indicate your acceptance of this License to do so, and all its terms and conditions for copying, distributing or modifying the Program or works based on it. 6. Each time you redistribute the Program (or any work based on the Program), the recipient automatically receives a license from the original licensor to copy, distribute or modify the Program subject to these terms and conditions. You may not impose any further restrictions on the recipients' exercise of the rights granted herein. You are not responsible for enforcing compliance by third parties to this License. 7. If, as a consequence of a court judgment or allegation of patent infringement or for any other reason (not limited to patent issues), conditions are imposed on you (whether by court order, agreement or otherwise) that contradict the conditions of this License, they do not excuse you from the conditions of this License. If you cannot distribute so as to satisfy simultaneously your obligations under this License and any other pertinent obligations, then as a consequence you may not distribute the Program at all. For example, if a patent license would not permit royalty-free redistribution of the Program by all those who receive copies directly or indirectly through you, then the only way you could satisfy both it and this License would be to refrain entirely from distribution of the Program. If any portion of this section is held invalid or unenforceable under any particular circumstance, the balance of the section is intended to apply and the section as a whole is intended to apply in other circumstances. It is not the purpose of this section to induce you to infringe any patents or other property right claims or to contest validity of any such claims; this section has the sole purpose of protecting the integrity of the free software distribution system, which is implemented by public license practices. Many people have made generous contributions to the wide range of software distributed through that system in reliance on consistent application of that system; it is up to the author/donor to decide if he or she is willing to distribute software through any other system and a licensee cannot impose that choice. This section is intended to make thoroughly clear what is believed to be a consequence of the rest of this License. 8. If the distribution and/or use of the Program is restricted in certain countries either by patents or by copyrighted interfaces, the original copyright holder who places the Program under this License may add an explicit geographical distribution limitation excluding those countries, so that distribution is permitted only in or among countries not thus excluded. In such case, this License incorporates the limitation as if written in the body of this License. 9. The Free Software Foundation may publish revised and/or new versions of the General Public License from time to time. Such new versions will be similar in spirit to the present version, but may differ in detail to address new problems or concerns. Each version is given a distinguishing version number. If the Program specifies a version number of this License which applies to it and "any later version", you have the option of following the terms and conditions either of that version or of any later version published by the Free Software Foundation. If the Program does not specify a version number of this License, you may choose any version ever published by the Free Software Foundation. 10. If you wish to incorporate parts of the Program into other free programs whose distribution conditions are different, write to the author to ask for permission. For software which is copyrighted by the Free Software Foundation, write to the Free Software Foundation; we sometimes make exceptions for this. Our decision will be guided by the two goals of preserving the free status of all derivatives of our free software and of promoting the sharing and reuse of software generally. NO WARRANTY 11. BECAUSE THE PROGRAM IS LICENSED FREE OF CHARGE, THERE IS NO WARRANTY FOR THE PROGRAM, TO THE EXTENT PERMITTED BY APPLICABLE LAW. EXCEPT WHEN OTHERWISE STATED IN WRITING THE COPYRIGHT HOLDERS AND/OR OTHER PARTIES PROVIDE THE PROGRAM "AS IS" WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. THE ENTIRE RISK AS TO THE QUALITY AND PERFORMANCE OF THE PROGRAM IS WITH YOU. SHOULD THE PROGRAM PROVE DEFECTIVE, YOU ASSUME THE COST OF ALL NECESSARY SERVICING, REPAIR OR CORRECTION. 12. IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MAY MODIFY AND/OR REDISTRIBUTE THE PROGRAM AS PERMITTED ABOVE, BE LIABLE TO YOU FOR DAMAGES, INCLUDING ANY GENERAL, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING OUT OF THE USE OR INABILITY TO USE THE PROGRAM (INCLUDING BUT NOT LIMITED TO LOSS OF DATA OR DATA BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY YOU OR THIRD PARTIES OR A FAILURE OF THE PROGRAM TO OPERATE WITH ANY OTHER PROGRAMS), EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGES. END OF TERMS AND CONDITIONS How to Apply These Terms to Your New Programs If you develop a new program, and you want it to be of the greatest possible use to the public, the best way to achieve this is to make it free software which everyone can redistribute and change under these terms. To do so, attach the following notices to the program. It is safest to attach them to the start of each source file to most effectively convey the exclusion of warranty; and each file should have at least the "copyright" line and a pointer to where the full notice is found. Copyright (C) 19yy This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; either version 2 of the License, or (at your option) any later version. This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. You should have received a copy of the GNU General Public License along with this program; if not, write to the Free Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. Also add information on how to contact you by electronic and paper mail. If the program is interactive, make it output a short notice like this when it starts in an interactive mode: Gnomovision version 69, Copyright (C) 19yy name of author Gnomovision comes with ABSOLUTELY NO WARRANTY; for details type `show w'. This is free software, and you are welcome to redistribute it under certain conditions; type `show c' for details. The hypothetical commands `show w' and `show c' should show the appropriate parts of the General Public License. Of course, the commands you use may be called something other than `show w' and `show c'; they could even be mouse-clicks or menu items--whatever suits your program. You should also get your employer (if you work as a programmer) or your school, if any, to sign a "copyright disclaimer" for the program, if necessary. Here is a sample; alter the names: Yoyodyne, Inc., hereby disclaims all copyright interest in the program `Gnomovision' (which makes passes at compilers) written by James Hacker. , 1 April 1989 Ty Coon, President of Vice This General Public License does not permit incorporating your program into proprietary programs. If your program is a subroutine library, you may consider it more useful to permit linking proprietary applications with the library. If this is what you want to do, use the GNU Library General Public License instead of this License. mrtg-ping-probe-2.2.0/COPYRIGHT0000444000372000353120000000156107730657750011521 mrtg-ping-probe - A Round Trip Time Probe for MRTG - The Multi Router Traffic Grapher. Copyright (c) 1997-2003 Peter W. Osel . All rights reserved. This program is free software; you can redistribute it and / or modify it under the terms of the GNU General Public License version 2 as published by the Free Software Foundation. This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. You should have received a copy of the GNU General Public License along with this program; if not, write to the Free Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. @(#) $Id: COPYRIGHT,v 2.3 2003/09/13 18:04:29 pwo Exp $ @(#) mrtg-ping-probe release $Name: Release_2_2_0 $ mrtg-ping-probe-2.2.0/ChangeLog0000444000372000353120000001655507730657750012011 2003-09-13 Peter W. Osel * Release 2_2_0 * mrtg-ping-probe, check-ping-fmt: added support italian Windows loacale with the help of Reale Marco * mrtg-ping-probe: on Windows actually return deadtime when we lost all packets, not 0. When the Windows ping loses all packets (100% loss), it still returns a valid summary with a rtt of 0. Now we detect this case and reset the rtt to the given deadtime, so the expected value is returned. bug reported by "Russ Grotewold" 2003-02-23 Peter W. Osel * ChangeLog, mrtg-ping-probe: fixed spelling errors as pointed out by Francois Wolmarans and by ispell(1). * mrtg-ping-probe: fixed killing of child process, the first argument of the perl kill function has to be the signal. Reported by Wilfried Gaensheimer . raised minimum version of perl supported to 5.6.1 default to use /bin/perl and not /usr/local/bin/perl initialize ping_output variable to empty string. * extended copyright to current year 2002-07-14 Peter W. Osel * Release 2_1_0 * mrtg-ping-probe, check-ping-fmt: added support for Mac OS X (Darwin 5.4), with the help of Fred Inklaar . added support for RedHat Linux 7.3 (and possibly other new Linux distributions using new ping versions), with the help of Thomas Sailer , Ulf Viney , Enrique Iglesias Rodriguez , Martin , and . added support for parsing the windows ping output in different locales: brazilian with the help of Marcio Queiroz colombian with the help of Victor Maldonado german with the help of and Harald Reisinger" * mrtg-ping-probe, INSTALL: ***** Possible Incompatibility ***** on freebsd > 3.x 'ping -s' is only allowed to be used by root. We no longer pass the packet size option to ping on freebsd, unless we run as root (which we shouldn't). Pointed out by Willem Jan Withagen . * check-ping-fmt: added copyright message * extended copyright to current year, changed my mail address from pwo@guug.de to pwo@pwo.de. * README: added link to smokeping, the mrtg of latency monitoring 2001-01-21 Peter W. Osel * Release 2_0_2 2001-01-08 Peter W. Osel * mrtg-ping-probe: further fine tuning and simplifying the regular expressions to match ping's output on FreeBSD 4.x, RedHat 6.x, and Solaris 7 with the help of David Richardson and James Eborall . 2001-01-07 Peter W. Osel * Release 2_0_1 * mrtg-ping-probe: verify that alarm() function exists. I have not found a perl distribution that implements the alarm() built-in function on Win32. It seems that you cannot timeout on most blocking system calls on Win32. Blame Microsoft ;-). fixed regular expressions for round trip time and packet loss summaries. Almost all but Solaris did no longer match. 2001-01-06 Peter W. Osel * Release 2_0_0 * Makefile: added initial support to generate pgp signed md5 checksum files for tar/shar/zip archives to protect against trojan horses. 2001-01-02 Peter W. Osel * mrtg-ping-probe: The pick-list now allows to multiply the ping returned value by an integer factor (e.g. to multiply by 1000 to graph LAN ping times smaller than a millisecond with pings returning fractions of a millisecond). Introduced the -D debug option to control the insanity increase imposed on me programming mrtg-ping-probe. * mrtg-ping-probe, check-ping-fmt: match and pass fractional ping times all the way up, convert to integer after multiplying with the given factor, just before we print the values merged regular expressions of different windows locales together, probably catching more locales now. 2001-01-01 Peter W. Osel * mrtg-ping-probe: added support for RedHat 7, with the help of Scott Shipley . RedHat 7 prints "mdev" instead of "stddev". * mrtg-ping-probe, check-ping-fmt: added support for parsing the windows ping output in different locales: french contributed by Jerome Moinet , with the help of Nicolas portugesee with the help of Luis Rafael spanish with the help of Luis Carrizo 2000-09-03 Peter W. Osel * mrtg-ping-probe: added timeout option to abort external ping programs that seem to hang (i.e. wait to _receive_ the given number of ECHO_RESPONSE packets, instead of just sending them; if your target is unreachable, these pings ping forever ...); based on a contribution by Peter "Pete" Chen . added option to set deadtime (the value we return when we assume that the target is unreachable). added option -s (silent mode) to suppress error messages in case the ping times out or the target is unreachable. added option -p (pick/print) to select which values to print. valid arguments are: min/max/avg/loss/number. Finally we have support to graph packet loss ;-) new function check_numeric() to check numeric arguments prepared for adding internal, perl based ping. do not setup redirection for OS/2. OS/2 does like stderr redirection we use in Unix (2>&1), but Perl tries to be "smart" about when to run a command directly and when to run it via the shell. Presumably it gets it wrong in this case. pointed out by Voytek Eymont added support for OpenBSD, contributed by Xander Soldaat * mrtg.cfg-ping: added example for new Packet Loss monitoring. * INSTALL: extended copyright to current year, updated URLs for software, added hint when to configure a timeout option. * README: updated URLs for software * mrtg-ping-probe, README: extended copyright to current year, added support for NetBSD (contributed by Ola Eriksson ). 2000-01-29 Peter W. Osel * COPYRIGHT: restricted copyright to version 2 of the GNU General Public License 1999-01-01 Peter W. Osel * mrtg-ping-probe: new option -o to pass options to the ping program called. * changed RCS keywords to include SCCS magic string @(#) such that the SCCS what(1) command displays them. * COPYRIGHT, README, check-ping-fmt, mrtg-ping-probe, mrtg-ping-success-probe: extended copyright to current year. * README: described where to find the latest release. Added hint to act responsible. * README, INSTALL: general cleanup, moved parts back and forth between these two files, to a hopefully more logical split. * NEWS: changed date format from yyyy/mm/dd to yyyy-mm-dd * mrtg-ping-probe: do not redirect stderr for MSWin32; Windows 95/98 do not support this - they create the file '&1' and print an error message 'Bad parameter 2'. Windows NT does support stderr redirection, but the ping programs don't print anything to stderr. So why bother ;-). Fix provided by Pavel Juran . * ChangeLog: new file to log changes in great details mrtg-ping-probe-2.2.0/INSTALL0000444000372000353120000001341107730657750011254 mrtg-ping-probe - A Round Trip Time and Packet Loss Probe for MRTG - The Multi Router Traffic Grapher. Copyright (c) 1997-2003 Peter W. Osel . All rights reserved. See the file COPYRIGHT in the distribution for the exact terms. Please read the file README first. Please make sure you have the latest release of mrtg-ping-probe. Read the file README to find out where to get the latest release. Make sure you have the following software installed on your system: - perl I use version 5.003, but any later version will most likely work without any problem. - MRTG I use version 2.8.8, but any 2.x version will most likely work without any problem. - a ping program You need a ping program that displays a summary of the round trip times upon termination or timeout. mrtg-ping-probe knows how to call the system's native ping program for supported systems (see the file README for a list). See below for platform specific information and for information on adding support for a new system. Check the script mrtg-ping-probe, and adapt the path to your perl if necessary. Put the script into a place where MRTG can call it, e.g. the your MRTG binary directory. Edit your mrtg.cfg file to add statements for the devices you want to ping. See mrtg.cfg-ping for an example. You might also use and customize the contributed script mrtg-ping-cfg to generate entries suitable for your environment. Optionally create the documentation in the format you like best, e.g. make html make man make tex Platform specific notes: * OS/2 - mrtg-ping-probe has been tested on OS/2 Warp4 with Perl 5.002 - mrtg-ping-probe "requires" perl 5.003 or better, you might need to change the line "require 5.003;" to "require 5.002;" - the Target line in your mrtg.cfg needs to include perl5: Target[pwo.de.ping]: `perl5 mrtg-ping-probe pwo.de` - depending on where you placed files, you might need to list the absolute pathname for mrtg-ping-probe. - test mrtg-ping-probe with the commands perl5 mrtg-ping-probe -V perl5 mrtg-ping-probe pwo.de * Solaris 2 and possibly others - some ping programs try to map IP addresses to hostnames. A ping can fail, if your DNS cannot resolve the address. If you use IP addresses in mrtg.cfg and want to suppress IP address to hostname mapping, pass the appropriate ping option, using the new -o option. E.g. on Solaris your Target[] declaration to ping the device at address 10.1.2.3 would look like this: Target[10.1.2.3]: `/usr/local/sbin/mrtg-ping-probe -o -n 10.1.2.3` * Windows 95/98/NT 4.0/2000 - the native ping program on Windows 95 and Windows NT 4.0 do not display a summary of the round trip times upon termination or timeout. You need to install a ping program that displays the summary information, e.g. the ping program of Windows 98 or Windows 2000. You can also use WinSock 2.x (see: http://www.sockets.com/). - the Target line in your mrtg.cfg might need to include the complete pathname to your perl executable and to the mrtg-ping-probe script: Target[pwo.de.ping]: `c:\perl5\perl c:\mrtg-2.5.2\mrtg-ping-probe pwo.de` - make sure that the quotes in the Target line are "back-quotes" (aka accent-grave, back-ticks, or as one Windows user once described it: "The ` is the one next to the 1 key and NOT the single quote below the double quote key." ;-) * some Linux, and possibly other platforms. - some ping programs won't stop until they received the configured number of ECHO_RESPONSE packets. If your target is unreachable, these ping will just keep sending ECHO_RESPONSE packets, and mrtg-ping-probe might seem to hang. In this case use the timeout option (-t timeout) to abort the ping after a reasonable time. You should configure a timeout, if the manual page of your ping mentions the phrase "(and receiving)" for the count option: -c count Stop after sending (and receiving) count ECHO_RESPONSE packets. * FreeBSD - on freebsd > 3.x 'ping -s' is only allowed to be used by root. We no longer pass the packet size option to ping on freebsd, unless we run as root (which we shouldn't). * Adding support for a new platform: - make sure you have the latest release of mrtg-ping-probe (See the file README where to find it) - make sure that the native ping program displays a summary of the round trip times upon termination or get and install a version that does so, e.g. ftp://ftp.nikhef.nl/pub/network/ping.tar.Z. - determine perl's idea about your platform name: perl -e 'use Config; print $Config{"osname"}, "\n"' - add a line to the %ping associative array for your platform, e.g.: 'linux' => "/bin/ping -c $count -s $length $host", where 'linux' is the output of the above perl command, /bin/ping the absolute pathname of your ping program, also check the documentation to adapt the arguments to ping. - test whether mrtg-ping-probe can find the summary information of your ping: mrtg-ping-probe some.host.name if you get the error message "ERROR: Could not find ping summary for some.host.name" you have to adapt the regular expression that matches the ping output in function ping(). - send context diffs of your changes to me, Peter W. Osel , so we can keep this distribution in sync. Also send the following information: output of the command "uname -a" output of the command "man ping" output of the ping command when pinging some hosts ten times, e.g. ping some.host.name 56 10 ping -c 10 some.host.name (The actual command arguments may be different) complete pathname of the native ping program, or if you use a non-native ping program, information on which ping you use. @(#) $Id: INSTALL,v 2.3 2003/09/13 18:04:29 pwo Exp $ @(#) mrtg-ping-probe release $Name: Release_2_2_0 $ mrtg-ping-probe-2.2.0/Makefile0000444000372000353120000000716407730657750011673 ################################################################## # @(#) $Id: Makefile,v 2.4 2003/09/13 18:04:29 pwo Exp $ # @(#) mrtg-ping-probe release $Name: Release_2_2_0 $ # # Copyright (c) 1997-2003 Peter W. Osel . # All Rights Reserved. # # See the file COPYRIGHT in the distribution for the exact terms. # ################################################################## # Makefile for mrtg-ping-probe ################################################################## PKG_NAME = mrtg-ping-probe PKG_NAME_DOS = pingp PKG_MAIN = pwo@pwo.de TAR = gtar SHAR = gshar ZIP = zip MD5SUM = gmd5sum PGP = pgp srcdir = . POD = mrtg-ping-probe MAN = $(POD).1 HTML = $(POD).html TEX = $(POD).tex DIST_COMMON = COPYING COPYRIGHT ChangeLog INSTALL Makefile NEWS README TODO SOURCES = mrtg-ping-probe EXTRA_DIST = check-ping-fmt mrtg-ping-cfg mrtg.cfg-ping DISTFILES = $(DIST_COMMON) $(SOURCES) $(HEADERS) $(TEXINFOS) $(MANS) $(EXTRA_DIST) all: man man: $(MAN) $(MAN): $(POD) pod2man $(POD) > $(MAN) html: $(HTML) $(HTML): $(POD) pod2html $(POD) > $(HTML) tex: $(TEX) $(TEX): $(POD) pod2latex $(POD) > $(TEX) clean: rm -f $(MAN) $(HTML) $(TEX) realclean: clean distclean: realclean ######################################################################## # dist: create the distribution tar and shar files # we rely that dist-ok does all error checking dist: dist-ok dist-dir @rel_tag=`grep "$(PKG_NAME) release" Makefile | sed -e 's/.*: //' -e 's/ .*$$//'`; \ rel_ver=`echo $$rel_tag | sed -e 's/^Release_//' -e 's/_/./g'`; \ rel_ver_dos=`echo $$rel_ver | sed -e 's/\.//g'`; \ distdir=$(PKG_NAME)-$$rel_ver; \ distdirdos=$(PKG_NAME_DOS)-$$rel_ver_dos; \ GZIP=-9; export GZIP; \ $(TAR) chozf $$distdir.tar.gz $$distdir; \ $(SHAR) -n $(PKG_NAME) -a -z -c -s $(PKG_MAIN) -o $$distdir.shar $$distdir; \ mv $$distdir $$distdirdos; \ $(ZIP) -or $$distdirdos $$distdirdos; \ rm -rf $$distdirdos; \ for file in $$distdir.tar.gz $$distdirdos.zip $$distdir.shar.[0-9][0-9]; do \ rm -f $$file.md5 $$file.md5.asc; \ $(MD5SUM) $$file > $$file.md5; \ $(PGP) -sta $$file.md5 && mv $$file.md5.asc $$file.md5; \ chmod 444 $$file.md5; \ done; ######################################################################## # dist-ok: ok to create a distribution? # check for valid Release tag in Makefile # check for current NEWS file dist-ok: @rel_tag=`grep "$(PKG_NAME) release" Makefile | sed -e 's/.*: //' -e 's/ .*$$//'`; \ rel_ver=`echo $$rel_tag | sed -e 's/^Release_//' -e 's/_/./g'`; \ if test -z "$$rel_tag" ; then \ echo "Makefile(dist-ok): empty release tag $$rel_tag; not releasing" 1>&2; \ exit 1; \ fi; \ if grep $$rel_tag NEWS > /dev/null; then \ echo "Makefile(dist-ok): found release tag $$rel_tag for $(PKG_NAME) release $$rel_ver"; \ else \ echo "Makefile(dist-ok): Can't find Release Tag $$rel_tag in file NEWS" 1>&2; \ echo "Makefile(dist-ok): not releasing" 1>&2; \ exit 1; \ fi ; \ ######################################################################## # dist-dir: create the distribution directory # we rely that dist-ok has already been called dist-dir: $(DISTFILES) @rel_tag=`grep "$(PKG_NAME) release" Makefile | sed -e 's/.*: //' -e 's/ .*$$//'`; \ rel_ver=`echo $$rel_tag | sed -e 's/^Release_//' -e 's/_/./g'`; \ rel_ver_dos=`echo $$rel_ver | sed -e 's/\.//g'`; \ distdir=$(PKG_NAME)-$$rel_ver; \ distdirdos=$(PKG_NAME_DOS)-$$rel_ver_dos; \ rm -rf $$distdir $$distdirdos; \ mkdir $$distdir; \ for file in $(DISTFILES); do \ d=$(srcdir); \ test -f $$distdir/$$file \ || ln $$d/$$file $$distdir/$$file 2> /dev/null \ || cp -p $$d/$$file $$distdir/$$file; \ done; \ chmod -R a+rX $$distdir; mrtg-ping-probe-2.2.0/NEWS0000444000372000353120000000770207730657750010730 2003-09-13 Release_2_2_0 * new platforms supported: italian Windows locale. * ***** Possible Incompatibility **** raised minimum required perl version to 5.6.1. Older perl versions might still work, but I am testing with 5.6.1 and 5.8.0 only. * bugfix: the ping child process should actually be killed now on Unix platforms. * bugfix: on Windows actually return deadtime when we lost all packets, not 0. * lots of typos fixed in comments and messages. 2002-07-14 Release_2_1_0 * new platforms supported: Mac OS X (Darwin 5.4), RedHat Linux 7.3 (and possibly other newer Linux Distributions using newer version of the ping program), brazilian, colombian, and german Windows. * ***** Possible Incompatibility **** on freebsd > 3.x 'ping -s' is only allowed to be used by root. We no longer pass the packet size option to ping on freebsd, unless we run as root (which we shouldn't). 2001-01-21 Release_2_0_2 * bugfix: failed to match ping summary on certain platforms (e.g. Linux) which included a mdev value. 2001-01-07 Release_2_0_1 * bugfix: almost all platforms but Solaris were broken, fixed regular expressions to find round trip time and packet loss. * bugfix: test for existence of perl builtin alarm(). Perl on Windows usually does not have it, and thus we cannot timeout the perl command. 2001-01-06 Release_2_0_0 * new platforms supported: NetBSD, OpenBSD, RedHat 7, french, portugesee, and spanish Windows 2000. * new feature: monitor packet loss, scale reported ping times by an integer factor, flexible selection of values to be monitored, option to suppress errors related to unreachable targets, option to select deadtime, option to select a timeout which aborts external ping program. * provide pgp signed md5 checksum files for tar/shar/zip archives to protect against trojan horses. 1999-01-01 Release_1_9_0 * new feature: added option -o to mrtg-ping-probe to pass options to the ping program called. Can e.g. be used to suppress address to hostname mapping which could cause the ping to fail if your DNS failed. Thanx Andy Kniveton for the idea. * bugfix: the file "&1" is no longer created on Windows 95/98, (this also gets rid of the bogus error message 'Bad parameter 2'). * rewrote README and INSTALL, which hopefully are more useful now. * detailed log of changes provided in file ChangeLog * list of tasks in file TODO 1998-05-22 Release_1_8_2 * better support for OS/2 1998-05-13 Release_1_8_1 * added support for OS/2 with the help of voytek@sbt.net.au * releases now also generate a .zip archive 1998-05-09 Release_1_8_0 * added support for Windows (Windows 98 / Windows NT 5.0) with the help of Ray Goodrich 1998-04-19 Release_1_7_2 * added support for FreeBSD 2.2.5 with the help of Jeff Mohler 1998-03-07 Release_1_7_1 * no user visible changes added Makefile targets to create distribution tar and shar files 1998-02-09 Release_1_7_0 * added support for OSF1 V3.2 contributed by Dobrica Pavlinusic 1997-08-22 Release_1_6_0 * added support for IRIX/6.2 contributed by Fabrizio Pivari 1997-05-20 Release_1_5_0 * added support for FreeBSD/2.2.1 with the help of Samath Wijesundara * captured output of external ping program now printed if we can't find the ping summary. 1997-03-12 Release_1_4_0 * prints now hostname for which ping summary was not found * added support for BSD/OS 2.1 with the help of Gildas Perrot 1997-03-08 Release_1_3_0 * added support for Linux, with the help of Mick Ghazey 1997-02-28 Release_1_2_0 * added support for AIX, contributed by Fabrizio Pivari 1997-02-19 Release_1_1_0 * Initial public release, included in mrtg_2.1 @(#) $Id: NEWS,v 2.6 2003/09/13 18:04:29 pwo Exp $ @(#) mrtg-ping-probe release $Name: Release_2_2_0 $ mrtg-ping-probe-2.2.0/README0000444000372000353120000001106507730657750011106 mrtg-ping-probe - A Round Trip Time and Packet Loss Probe for MRTG - The Multi Router Traffic Grapher. Copyright (c) 1997-2003 Peter W. Osel . All rights reserved. See the file COPYRIGHT in the distribution for the exact terms. See the file INSTALL for installation instructions. mrtg-ping-probe is a ping probe for MRTG 2.x. It is used to monitor the round trip time and packet loss to networked devices. MRTG uses its output to generate graphs visualizing minimum and maximum round trip times or packet loss. The latest release of mrtg-ping-probe can always be found on the web at http://pwo.de/projects/mrtg/ or via anonymous ftp at ftp://ftp.pwo.de/pub/pwo/mrtg/mrtg-ping-probe/ mrtg-ping-probe depends on the following software being installed on your system: perl (at least version 5.003), mrtg (I use version 2.8.8, though any mrtg 2.x version should work), and a ping program that displays a summary of the round trip times upon termination or timeout. mrtg-ping-probe runs on AIX, BSD/OS 2.1, FreeBSD/2.2.x, IRIX/6.2, Linux, Mac OS X (Darwin 5.4), NetBSD, OpenBSD, OS/2, OSF1 V3.2, Solaris 1.1.2 (SunOS 4.1.4), Solaris 2.5.1 (SunOS 5.5.1), Solaris 7 (SunOS 5.7), Solaris 8 (SunOS 5.8), Solaris 9 (SunOS 5.9), HP-UX 9, Windows 98, and Windows 2000 (english, french, portugesee, and spanish locales). If you install the Windows ping program that comes with Windows 98, Windows 2000, or WinSock 2.x, mrtg-ping-probe will also run on Windows 95 and Windows 4.0. Support for additional systems is usually easy to add, as described in the file INSTALL. Act responsible: do not use mrtg-ping-probe to ping devices without the owner's permission. Just imagine 10,000 people would decide to ping your hosts ... mrtg-ping-probe is meant to be used within your network to get round trip time performance figures for your network. Please check out Tobias Oetiker's smokeping ("the mrtg for latency") at http://people.ee.ethz.ch/~oetiker/webtools/smokeping/ SmokePing measures latency, latency distribution and packet loss in your network. It uses RRDtool to maintain the longterm datastore and to draws pretty graphs. IMPORTANT! Communicate any problem and suggested patches to me, Peter W. Osel , so we can keep this distribution in sync. If you have a problem, there will be someone else who had it or will have it too... If possible, send me patches such that the patch program will apply them. Context diffs are the best, then normal diffs. Do not send ed scripts, I have probably changed my copy since the version you got. I have to thank the following people Tobias Oetiker and Dave Rand for writing MRTG in the first place. Wee-Meng LEE for porting mrtg-ping-probe to HPUX 9.x and writing cfgpingmaker, which I renamed to mrtg-ping-cfg and plan to rewrite it in perl as soon as I find the time (tm;-) Simon Amor for his perl script. It was a big help and motivation to get mrtg-ping-probe started. Fabrizio Pivari for adding AIX support. Mick Ghazey for triggering the port to Linux. Dobrica Pavlinusic for adding OSF1 support. Ray Goodrich for adding support for Windows. Pavel Juran for valuable insights into the Windows world and information on WinSock 2.x for Windows 95/98. voytek@sbt.net.au for helping on the OS/2 port. Ola Eriksson for adding NetBSD support. Xander Soldaat for adding OpenBSD support. Scott Shipley for adding RedHat 7 support. Jerome Moinet and Nicolas for helping to support the french Windows locale, Luis Rafael for helping with the portugesee locale, and Luis Carrizo for helping with the spanish locale. Peter "Pete" Chen for his timeout contribution. Fred Inklaar for adding support for Mac OS X (Darwin 5.4). Thomas Sailer , Ulf Viney , Enrique Iglesias Rodriguez , Martin , and for helping to support RedHat Linux 7.3 (and possibly other new Linux distributions using new ping versions). Willem Jan Withagen for pointing out that freebsd 3.x and later no longer allows non-root user to use ping -s. @(#) $Id: README,v 2.3 2003/09/13 18:04:29 pwo Exp $ @(#) mrtg-ping-probe release $Name: Release_2_2_0 $ mrtg-ping-probe-2.2.0/TODO0000644000372000353120000005530007730657056010717 ####################################################################### * add md5 sum, gnupg signed. (change pgp to gnupg) * more testing needed for packet loss retrieval? * only print error messages for values we are asked for ...? * support rrdtool ... (replace mrtg-ping-probe by smokeping)? ####################################################################### * kill child and verify success, kill with TERM INT HUP KILL signals ChangeLog make extra sure we actually kill the child process, cycle through the TERM INT HUP and KILL signals when killing the child process. 221a223 > #DBG$ping{$Config{'osname'}} = "./test-kill"; 245c247,257 < kill("TERM", $pid); --- > #for my $sig (qw(TERM INT HUP KILL)) { > $sig="INT"; > print STDERR "${Prog_name}: DBG: kill child $pid (via $sig) ...\n"; > kill($sig, $pid); > sleep 1; > #last unless kill(0, $pid); > if (kill(0, $pid)) { > print STDERR "${Prog_name}: DBG: child $pid survived $sig ...\n"; > } > print STDERR "${Prog_name}: WARN: kill of child $pid (via $sig) failed...\n"; > # } Path: news.infineon.com!newsproxy.muc.infineon.com!dnewsfeed00.dtm.ops.eu.uu.net!dnewsifeed00.dtm.ops.eu.uu.net!bnewsifeed03.bru.ops.eu.uu.net!bnewspeer01.bru.ops.eu.uu.net!emea.uu.net!eusc.inter.net!zrz.TU-Berlin.DE!not-for-mail From: anno4000@lublin.zrz.tu-berlin.de (Anno Siegel) Newsgroups: comp.lang.perl.misc Subject: Re: Need Help: fork / kill / kill 0 Date: 26 Feb 2003 10:02:28 GMT Organization: working, but not speaking for Technische Universitaet Berlin Lines: 14 Message-ID: References: NNTP-Posting-Host: lublin.zrz.tu-berlin.de X-Newsreader: trn 4.0-test74 (May 26, 2000) Originator: anno4000@lublin.zrz.tu-berlin.de (Anno Siegel) Xref: news.infineon.com comp.lang.perl.misc:463307 Peter W. Osel wrote in comp.lang.perl.misc: > I have a script which starts a child (via open("$commad |)"); Then I try > to kill the child with signal TERM, if this did not kill the child, I > want to kill the child using INT, etc. The following code does not seem > to work (what am I missing?). It looks as if kill 0 $pid does not > detect that the child was killed? You must wait() (or rather waitpid()) for the child process after it was killed. Otherwise, the child process leaves a zombie which still can be signalled. [code snipped] Anno Path: news.infineon.com!newsproxy.muc.infineon.com!dnewsfeed00.dtm.ops.eu.uu.net!dnewsifeed00.dtm.ops.eu.uu.net!bnewsifeed03.bru.ops.eu.uu.net!bnewspeer01.bru.ops.eu.uu.net!emea.uu.net!fu-berlin.de!uni-berlin.de!port-212-202-168-14.reverse.qdsl-home.DE!not-for-mail From: Tina Mueller Newsgroups: comp.lang.perl.misc Subject: Re: Need Help: fork / kill / kill 0 Date: 26 Feb 2003 08:57:09 GMT Organization: http://www.tinita.de/ Lines: 52 Sender: tina Message-ID: References: NNTP-Posting-Host: port-212-202-168-14.reverse.qdsl-home.de (212.202.168.14) X-Trace: fu-berlin.de 1046249829 53785574 212.202.168.14 (16 [24002]) X-Orig-Path: not-for-mail User-Agent: tin/1.4.6-20020816 ("Aerials") (UNIX) (Linux/2.4.18-4GB (i686)) Xref: news.infineon.com comp.lang.perl.misc:463303 Peter W. Osel wrote: > I have a script which starts a child (via open("$commad |)"); Then I try > to kill the child with signal TERM, if this did not kill the child, I > want to kill the child using INT, etc. The following code does not seem > to work (what am I missing?). It looks as if kill 0 $pid does not > detect that the child was killed? > The main script: > --- > #!/opt/perl_5.6.1/bin/perl -w > # > $child = "./_test-kill-child.pl"; > unless ($pid = open(CHILD, "$child |")) { > print STDERR "${0}: FATAL: Can't open $child : $!"; > exit(1); > } > sleep 2; > for my $sig (qw(TERM INT HUP KILL)) { > print STDERR "${0}: DBG: kill child $pid (via $sig) ...\n"; > kill($sig, $pid); > sleep 2; > #last unless kill(0, $pid); > if (kill(0, $pid)) { > print STDERR "${0}: DBG: child $pid survived $sig ...\n"; > } you probably want to add a "last" here in case $pid was killed: else { last } > } > --- > The child script > --- > #!/opt/perl_5.6.1/bin/perl > $SIG{CHLD} = 'IGNORE'; put that into the main script and see what happens. also always be careful with filehandles while forking. see perldoc perlipc for details. hth, tina -- http://www.tinita.de/ \ enter__| |__the___ _ _ ___ http://Movies.tinita.de/ \ / _` / _ \/ _ \ '_(_-< of http://www.perlquotes.de/ \ \ _,_\ __/\ __/_| /__/ perception http://www.tinita.de/peace/link.html - Spread Peace ####################################################################### * error message should include version of mrtg-ping-probe, uname -a etc etc shell script/batch file to gather needed info in case of problem: perl -V, uname -a mrtg-ping-probe -V mrtg-ping-probe -D ebug trace ... ####################################################################### * windows: program around alarm(), timeout not supported: ActiveState: The alarm() builtin is not implemented on Win32 because the OS doesn't support it. The problem is basically that you cannot timeout on blocking system calls on Win32 (with only a few exceptions). So if Perl would be waiting on e.g. a socket read, there is no way to return from the read() call without having either some data arrive or the thread itself terminating. This makes the alarm() function pretty much useless on Win32. Go blame Microsoft. :-) ####################################################################### * remote execution of ping (schedule for release 2.x.0) (request by "Calvert, Neil" ) option: -r "[rsh:][user@]host[:ostype]" e.g.: -r "ssh:user@host:ostype" - rsh or ssh to other host. - other host has no perl. only ping, - need to "override" ostype, as we do not run on the same host (default: ostype of myself) - ostype: default: ostype(myself) - rsh: default ssh - user: default myself ${rsh} ${ruser} ${ping{osname}} ${redir_stderr} rsh -n -l ${user} ssh -n "" "" osname=Config 2>&1 or -option - rsh to cisco router? ostype = cisco|ios ?? ####################################################################### * take a close look at alternatives, maybe integrated them, or at least start a list of references, pointing to other useful tools: * pointed out by: Alexandros C. Couloumbis http://www.kyuzz.org/antirez/hping/ ftp://ftp.internatif.org/pub/unix/echoping/ http://www-iepm.slac.stanford.edu/tools/synack/ * check out Cisco IOS RTR (Response Time Reporter) for delay measurement: http://www.cisco.com/univercd/cc/td/doc/product/software/ios120/12cgcr/fun_c/fcprt3/fcmonitr.htm probably now called part of the SA Agent now. Network Monitoring Using Cisco Service Assurance Agent http://www.cisco.com/univercd/cc/td/doc/product/software/ios121/121cgcr/fun_c/fcprt3/fcd301d.htm Overview of IPM http://www.cisco.com/univercd/cc/td/doc/product/rtrmgmt/ipmcw2k/ipm20/ipmug20/ipmover.htm#xtocid165050 (reported by "Matt Katona" * check out rping http://www.marmoset.net/~knail1/scripts/rping/rping.html pointed out by Victor.Maldonado@intesa.com.co ####################################################################### * Better NT support, options to look into: - use better ping.exe (e.g. Win98 version) that summarizes - use own external standard ping program/ping.exe - write perl script that read standard Windows NT ping output and creates a summary similar to Win98 - use perl based ping (see Ian Baker and Raymond Lucas ) - calculate min/max/avg/loss values from standard system ping (see "Edward Paijmans" ) ####################################################################### * Internal/External Ping/ICMP vs NTP delay - add discussion about icmp echo vs ntp delay - discuss why we don't use a perl ping.... (need root for icmp) - icmp only by root ?! (no problem on windows?) - if non-root -> only echo, which could be switched off. - require fping? or ping from .nl? - provide option to provide ping string including pipe? ####################################################################### * Better support for running in foreign locales: can we set the locale to force english output? ####################################################################### From mrtg-request@list.ee.ethz.ch Mon Jun 29 12:58:37 1998 Return-Path: Resent-Date: Mon, 29 Jun 1998 21:38:59 +0200 (MET DST) Old-Return-Path: From: Matthew Petach Message-Id: <199806291936.MAA17855@b5.eng.internex.net> Subject: Re: [MRTG] Ping probe sync Interfaces or async intefaces ? what about loopback ? To: jeremy@iway.fr Date: Mon, 29 Jun 1998 12:36:43 -0700 (PDT) Cc: mrtg@list.ee.ethz.ch In-Reply-To: <3597CC4D.B049CE3A@iway.fr> from "Jérémy Lacroix" at Jun 29, 98 06:18:05 pm Resent-Message-ID: <"M_rbCB.A.KEF.U0-l1"@tardis> Resent-From: mrtg@list.ee.ethz.ch X-Mailing-List: archive/latest/3995 Resent-Sender: mrtg-request@list.ee.ethz.ch Recently, J=E9r=E9my Lacroix talked about "[MRTG] Ping probe sync Interfa= ces or async intefaces ? what about loopback ?", and said > > Hello, > I'm working on latency time on our backbone. We're using ping probe on > our ciscos to visualize the latency times. *sigh* I've really tried to keep my mouth shut about this for a long time. using PING as a measurement of network latency is a stupid idea. ICMP echo requests are generally the first things to be ignored/discarded by the routing devices, and the granularity level they provide is minimal at best. if you want to get more accurate, more reasonable numbers for network latency, rather than simply "how loaded is the router at the other end" (based on how quickly it decides to answer the echo request, if at all), use NTP. Enable NTP service on your routers, apply an access list to keep other people from abusing it, have each of your routers NTP peer with each other, and then a simple ./ntpq -n -c lopeers XX.YY.ZZ.AA | awk '{print $1"\t" $8}' | sed 's/[-+*]//g' (use the IP address of the router you're querying) will print out the IP address and delay down to the 10-microsecond level from that router to every other NTP-peering router, like this: 207.88.0.74 83.56 15.255.160.64 50.13 198.93.3.1 6.12 204.123.2.5 6.84 128.115.14.97 12.59 192.5.5.245 0.00 205.158.2.246 2.66 192.5.5.242 0.00 205.158.2.251 83.42 207.88.0.98 52.20 205.158.0.7 2.61 207.88.182.2 9.37 Simply muliply the second column by 1000, and you have your *accurate* delay time between routers in microseconds, with a + or - 10 microsecond variance. AND, NTP queries aren't discarded by the routers, nor are they treated as a low priority request, so you don't have to worry about getting poor numbers simply because the device at the other end is heavily loaded. I'm sorry to rant like this, I just get so upset when I see people trying to use ICMP messages for measuring network latency. :( :( :( Matt Petach > However, the cisco are discarding ICMP packet on serial (synchron) > interfaces when there is an overload, which means errors in graphs...... > > I'm currently solving the problem in pinging the sync interface (eth) of > cisco, but i was wondering how we could trust the result of ping-probe > on a loopback interface ? > > Does-it discarding ICMP packet ? if yes it mean cisco CP Booard is > emulating the discarding of ICMP (loopback could be setup without card > in cisco), and in that case what is the algorythm ? > > -- > J=E9r=E9my Lacroix, Resp. Exploitation R=E9seau UUNET France > ---> mailto:jlacroix@iway.fr ---> http://www.iway.fr > UUNET France, 215 Av. Clemenceau 92000 Nanterre > Tel : (33)-01-56-38-22-00 / Fax : (33)-01-56-38-22-01 -- Concentric Network | Matthew Petach {MP59} Senior Network Architect | mpetach@internex.net 2306 Walsh Avenue | Tel: (408) 327-2411 Santa Clara, CA 95051 | Fax: (408) 496-5484 From mattp@internex.net Mon Jul 20 12:45:40 1998 Return-Path: X-Envelope-Sender-Is: mattp@Internex.NET (at relayer david.siemens.de) From: Matthew Petach Message-Id: <199807201937.MAA11118@b5.eng.internex.net> Subject: [PWO] Re: [MRTG] Ping probe sync Interfaces or async intefaces ? what about loopback ? To: pwo@mc.HL.Siemens.DE (Peter W. Osel) Date: Mon, 20 Jul 1998 12:37:45 -0700 (PDT) Cc: mattp@internex.net, jeremy@iway.fr In-Reply-To: <19980719221513.14011@mc.HL.Siemens.DE> from "Peter W. Osel" at Jul 19, 98 10:15:13 pm Recently, Peter W. Osel talked about "Re: [MRTG] Ping probe sync Interfac= es or async intefaces ? what about loopback ?", and said > > Matt, > > thanx for your comments; If you don't mind, I would like to include > them in the README file of the mrtg-ping-probe in one form or another, > if this is ok with you (may I include a reference to your name/Email > address?). Sure! Actually, you should probably use mpetach@concentric.com, since we've now been bought by Concentric. :) Matt_P -- Concentric Network | Matthew Petach {MP59} Senior Network Architect | mpetach@concentric.com 2306 Walsh Avenue | Tel: (408) 327-2411 Santa Clara, CA 95051 | Fax: (408) 496-5484 ######################################################################## From avdlaan@att.nl Tue May 26 04:38:48 1998 From: avdlaan@att.nl Message-ID: <356AA90F.52E8@att.nl> Date: Tue, 26 May 1998 13:35:43 +0200 Original-From: Arjan van der Laan Organization: AT&T To: pwo@SMI.Siemens.COM, RGoodrich@aviant.com Subject: [PWO] mrtg-ping-probe for Windows NT4.0 Hi, I use Windows NT 4.0 and wanted to use use your ping-probe program but found out as I could see in the mail history NT4.0 ping program has no summary line. I tweaked your perl script slightly to produce the summary from the script. As I am not a die hard perl programmer I consider my lines as 'quick and dirty'. But they work ! Perhaps they are of use to you. Thanks for supporting MRTG and Best Regards, Arjan van der Laan. PS I do not know what effect this new script has on the NT5.0 ping program..... If you can tell me how to get that program I can test it. *** mrtg-ping-probe Fri Jan 1 18:58:48 1999 --- x Fri Jan 1 18:58:39 1999 *************** *** 1,7 **** #!/usr/local/bin/perl ################################################################## # $Id: mrtg-ping-probe,v 1.15 1998/05/14 00:04:02 pwo Exp $ ! # mrtg-ping-probe release $Name: $ # # Copyright (c) 1997,1998 by Peter W. Osel , Cupertino. # All Rights Reserved. --- 1,7 ---- #!/usr/local/bin/perl ################################################################## # $Id: mrtg-ping-probe,v 1.15 1998/05/14 00:04:02 pwo Exp $ ! # mrtg-ping-probe release $Name: Release_1_8_1 $ # # Copyright (c) 1997,1998 by Peter W. Osel , Cupertino. # All Rights Reserved. *************** *** 25,30 **** --- 25,31 ---- $Prog_vers = q$Revision: 1.15 $; $Prog_id = q$Id: mrtg-ping-probe,v 1.15 1998/05/14 00:04:02 pwo Exp $; $Usage = "Usage: $Prog_name [-hvV] [-k count] [-l length] host\n"; + $pns = 0; #for windows ping without summary # Parse Command Line: die $Usage unless getopts('hk:l:vV'); *************** *** 138,144 **** elsif (m|^\s+Minimum\s+=\s+(\d+)(?:\.\d+)?ms,\s+Maximum\s+=\s+(\d+)(?:\.\d+)?ms,\s+Average\s+=\s+(\d+)(?:\.\d+)?ms|) { close(PING), return($1,$3,$2); } ! } print STDERR "${Prog_name}: ERROR: Could not find ping summary for $host\n"; print STDERR "${Prog_name}: INFO: The output of the ping command $ping{$Config{'osname'}} was:\n"; --- 139,156 ---- elsif (m|^\s+Minimum\s+=\s+(\d+)(?:\.\d+)?ms,\s+Maximum\s+=\s+(\d+)(?:\.\d+)?ms,\s+Average\s+=\s+(\d+)(?:\.\d+)?ms|) { close(PING), return($1,$3,$2); } ! ! #fix by avdlaan for Windows NT4.0 ! elsif (m/^Reply\s+from\s+$host:\s+bytes=$length\s+time=(\d+)(?:\.\d+)?ms\s+TTL/) { ! $pns=1, $ping_count++; ! $avg=int(($1 + $total) / $ping_count), $total=$total + $1; ! if ($ping_count==1) {$min = $1, $max = $1;} ! elsif ($1 <= $min) {$min = $1;} ! elsif ($1 >= $max) {$max = $1;} ! } ! } ! if ($pns=1) {close(PING), return($min,$avg,$max)}; ! #end of fix print STDERR "${Prog_name}: ERROR: Could not find ping summary for $host\n"; print STDERR "${Prog_name}: INFO: The output of the ping command $ping{$Config{'osname'}} was:\n"; From paijmans@telebyte.nl Wed Oct 21 09:05:39 1998 Return-Path: Message-Id: <199810211604.SAA04385@degas.telebyte.nl> From: "Edward Paijmans" To: Subject: [PWO] mrtg-ping-probe adaption. Date: Wed, 21 Oct 1998 16:06:54 +0100 Peter, Sitting behind an NT4.0 PC and impressed by the mrtg tool I thought it would be useful for me if the mrtg-ping-probe would work on NT4.0. I changed the code of the mrtg-ping-probe a bit to include rudimentary NT4.0 (and W95) support. The only changes I made is one section (clearly marked with comment blocks) in the mrtg-ping-probe code. This new code calculates an average and determines the minimum and maximum round trip delay times from the samples returned. If none of the samples return a valid time than the maximum and minimum is set to 3000 (indicating the system to be unavailable). One disadvantage of this new code is that for operating systems identified with 'MSWin32' a command error does no longer deliver output to the STDERR showing what went wrong. I just thought that if it is useful for me other people might be interested too. If you want to include this into your mrtg-ping-probe distribution, feel free to do so. Regards, Edward Paijmans *** mrtg-ping-probe Fri Jan 1 19:01:45 1999 --- mrtg-ping-probe-new Fri Jan 1 19:01:34 1999 *************** *** 1,7 **** #!/usr/local/bin/perl ################################################################## # $Id: mrtg-ping-probe,v 1.16 1998/05/22 06:58:22 pwo Exp $ ! # mrtg-ping-probe release $Name: $ # # Copyright (c) 1997,1998 by Peter W. Osel , Cupertino. # All Rights Reserved. --- 1,7 ---- #!/usr/local/bin/perl ################################################################## # $Id: mrtg-ping-probe,v 1.16 1998/05/22 06:58:22 pwo Exp $ ! # mrtg-ping-probe release $Name: Release_1_8_2 $ # # Copyright (c) 1997,1998 by Peter W. Osel , Cupertino. # All Rights Reserved. *************** *** 40,50 **** # Check Sanity of Arguments unless ($PacketCount =~ /^\d+$/) { ! print STDERR "$Prog_name: FATAL: option -k requires numeric argument.\n"; ++$err; } unless ($PacketLength =~ /^\d+$/) { ! print STDERR "$Prog_name: FATAL: option -l requires numeric argument.\n"; ++$err; } --- 40,52 ---- # Check Sanity of Arguments unless ($PacketCount =~ /^\d+$/) { ! print STDERR "$Prog_name: FATAL: option -k requires numeric ! argument.\n"; ++$err; } unless ($PacketLength =~ /^\d+$/) { ! print STDERR "$Prog_name: FATAL: option -l requires numeric ! argument.\n"; ++$err; } *************** *** 83,89 **** # Still looking for a perl internal ping function that reports # round trip time. ! ($pt_min, $pt_avg, $pt_max) = ping($HostToPing, $PacketLength, $PacketCount); # The external mrtg probe returns up to 4 lines of output: # 1. Line: current state of the 'incoming bytes counter' --- 85,92 ---- # Still looking for a perl internal ping function that reports # round trip time. ! ($pt_min, $pt_avg, $pt_max) = ping($HostToPing, $PacketLength, ! $PacketCount); # The external mrtg probe returns up to 4 lines of output: # 1. Line: current state of the 'incoming bytes counter' *************** *** 122,148 **** ); unless (defined($ping{$Config{'osname'}})) { ! print STDERR "${Prog_name}: FATAL: Not yet configured for $Config{'osname'}\n"; exit(1); } unless (open(PING, "$ping{$Config{'osname'}} 2>&1 |")) { ! print STDERR "${Prog_name}: FATAL: Can't open $ping{$Config{'osname'}}: $!"; exit(1); } while () { $ping_output .= $_; ! if (m|^round-trip(?: \(ms\) )? min/avg/max(?:/stddev)? = (\d+)(?:\.\d+)?/(\d+)(?:\.\d+)?/(\d+)(?:\.\d+)?|) { close(PING), return($1,$2,$3); } ! elsif (m|^\s+Minimum\s+=\s+(\d+)(?:\.\d+)?ms,\s+Maximum\s+=\s+(\d+)(?:\.\d+)?ms,\s+Average\s+=\s+(\d+)(?:\.\d+)?ms|) { close(PING), return($1,$3,$2); } } ! ! print STDERR "${Prog_name}: ERROR: Could not find ping summary for $host\n"; ! print STDERR "${Prog_name}: INFO: The output of the ping command $ping{$Config{'osname'}} was:\n"; print STDERR "$ping_output\n"; close(PING), return(0,0,0); --- 125,191 ---- ); unless (defined($ping{$Config{'osname'}})) { ! print STDERR "${Prog_name}: FATAL: Not yet configured for $Config{'osname'}\n"; exit(1); } unless (open(PING, "$ping{$Config{'osname'}} 2>&1 |")) { ! print STDERR "${Prog_name}: FATAL: Can't open $ping{$Config{'osname'}}: $!"; exit(1); } while () { $ping_output .= $_; ! if (m|^round-trip(?: \(ms\) )? min/avg/max(?:/stddev)? = (\d+)(?:\.\d+)?/(\d+)(?:\.\d+)?/(\d+)(?:\.\d+)?|) { close(PING), return($1,$2,$3); } ! elsif (m|^\s+Minimum\s+=\s+(\d+)(?:\.\d+)?ms,\s+Maximum\s+=\s+(\d+)(?:\.\d+)?ms,\s+Average\s+=\s+(\d+)(?:\.\d+)?ms|) { close(PING), return($1,$3,$2); } } ! ! ############################################################################ ! # Added by E. Paijmans to support ping probe on NT4.0 (W95) ! # NT4.0 does not support min, max, avg. These values have to be determined ! # from the lines returned. ! # syntax of returned records: ! # Reply from aa.bb.cc.dd: bytes=56 time=10ms TTL=255 ! # or in case of a timeout: ! # Request timed out. ! ! if ($Config{'osname'} =~ "MSWin32") { ! $min = 3000; # 3 seconds is taken as max round trip delay, default NT4.0 times out at 2 seconds. ! @ping_result = split(/\n/,$ping_output); ! foreach (@ping_result){ ! if (/\stime\W(\d+)/) { ! if ($1 < $min) { $min = $1 } ! if ($1 > $max) { $max = $1 } ! $tot += $1; ! $num ++; ! } ! elsif (/timed out/) { $unreach = 3000 } ! } ! if ($unreach == 3000 && $num == 0) { $max = 3000 } ! unless ($num == 0) {$avg = int($tot / $num)} ! close(PING), return($min,$avg,$max); ! } ! # End of section added for NT4.0 ! ############################################################################ ! ! print STDERR "${Prog_name}: ERROR: Could not find ping summary for $host\n"; ! print STDERR "${Prog_name}: INFO: The output of the ping command $ping{$Config{'osname'}} was:\n"; print STDERR "$ping_output\n"; close(PING), return(0,0,0); mrtg-ping-probe-2.2.0/mrtg-ping-probe0000555000372000353120000004737207730657750013177 #!/bin/perl ################################################################## # @(#) $Id: mrtg-ping-probe,v 2.5 2003/09/13 18:04:29 pwo Exp $ # @(#) mrtg-ping-probe release $Name: Release_2_2_0 $ # # Copyright (c) 1997-2003 Peter W. Osel . # All Rights Reserved. # # See the file COPYRIGHT in the distribution for the exact terms. # ################################################################## # # "I saw -- from the cathedral -- you were watching me" # # -- Tanita Tikaram, `Cathedral Song' # on: Tanita Tikaram, `Ancient Heart', 1988, WEA Records # ################################################################## use 5.6.1; use Getopt::Std; use File::Basename; use Config; $Prog_name = basename($0); # Who I am $Prog_vers = q$Revision: 2.5 $; $Prog_id = q$Id: mrtg-ping-probe,v 2.5 2003/09/13 18:04:29 pwo Exp $; $Usage = "Usage: $Prog_name [-hsvV] [-d deadtime] [-k count] [-l length] [-o ping_options] [-p [factor*]{min|max|avg|loss|integer}/[factor*]{min|max|avg|loss|integer}] [-r [rsh:][user@]host[:osname]] [-t timeout] host\n"; # Parse Command Line: die $Usage unless getopts('d:Dhk:l:o:p:r:st:vV'); # Generic Options $Debug = defined($opt_D) ? $opt_D : 0; $PrintHelp = defined($opt_h) ? $opt_h : 0; $Verbose = defined($opt_v) ? $opt_v : 0; $Silent = defined($opt_s) ? $opt_s : 0; $PrintVersion = defined($opt_V) ? $opt_V : 0; # Tool Specific Options $DeadTime = defined($opt_d) ? $opt_d : 0; $PacketCount = defined($opt_k) ? $opt_k : "10"; $PacketLength = defined($opt_l) ? $opt_l : "56"; $PingOptions = defined($opt_o) ? $opt_o : ""; $PickList = defined($opt_p) ? $opt_p : "max/min"; $RemotePing = defined($opt_r) ? $opt_r : ""; $TimeOut = defined($opt_t) ? $opt_t : 0; # Check Sanity of Arguments $err += check_numeric("-d", $DeadTime); $err += check_numeric("-k", $PacketCount); $err += check_numeric("-l", $PacketLength); $err += check_numeric("-t", $TimeOut); $err += check_picklst("-p", $PickList); if ($err) { print STDERR $Usage; exit(1); } if ($PrintVersion ) { print STDERR "$Prog_name: $Prog_vers\n"; exit(0); } if ($PrintHelp) { print $Usage; exit(0); } if (@ARGV > 1) { print STDERR "$Prog_name: ERROR: ignoring superfluous arguments\n"; print STDERR "$Usage"; } if (@ARGV < 1) { print STDERR "$Prog_name: FATAL: ping what?\n"; print STDERR "$Usage"; exit(1); } ($HostToPing) = @ARGV; ($pt{min}, $pt{avg}, $pt{max}, $pt{loss}) = ping($HostToPing, $PacketLength, $PacketCount, $TimeOut); print "$Prog_name: DBG: main(): ping() ret: $pt{min}, $pt{avg}, $pt{max}, $pt{loss}\n" if $Debug; $PickList =~ /^(?:(\d+)\*)?(\w+)\/(?:(\d+)\*)?(\w+)$/; ($f1, $p1, $f2, $p2) = ($1, $2, $3, $4); $f1 = $f1 ? $f1 : 1; $f2 = $f2 ? $f2 : 1; print "$Prog_name: DBG: main(): before psub: f = ($f1 $f2); p = ($p1 $p2)\n" if $Debug; $p1 = $p1 =~ /^\d+$/ ? $p1 : $pt{$p1}; $p2 = $p2 =~ /^\d+$/ ? $p2 : $pt{$p2}; print "$Prog_name: DBG: main(): after psub: f = ($f1 $f2); p = ($p1 $p2)\n" if $Debug; # The external mrtg probe returns up to 4 lines of output: # 1. Line: current state of the 'incoming bytes counter' # 2. Line: current state of the 'outgoing bytes counter' # 3. Line: string, telling the uptime of the target. # 4. Line: telling the name of the target. # We leave out line 3, and 4. printf "%d\n%d\n", $f1 * $p1, $f2 * $p2; exit(0); ################################################################## sub check_numeric { my($opt, $val) = @_; my($err) = 0; unless ($val =~ /^\d+$/) { print STDERR "$Prog_name: FATAL: option $opt requires numeric argument.\n"; ++$err; } return($err); } ################################################################## sub check_picklst { my($opt, $val) = @_; my($err, $i) = (0, 0); my(@v, @n); unless ($val =~ /^(?:(\d+)\*)?(\w+)\/(?:(\d+)\*)?(\w+)$/) { print STDERR "$Prog_name: FATAL: option $opt requires [factor*]word/[factor*]word argument, I found \"$val\"\n"; ++$err; } @n = ($1, $3); @v = ($2, $4); print "$Prog_name: DBG: check_picklst(): n = (@n); v = (@v)\n" if $Debug; foreach $i (0..1) { unless ($v[$i] =~ /^(min|max|avg|loss|\d+)$/) { print STDERR "$Prog_name: FATAL: option $opt uses unknown item $v[$i]\n"; print STDERR "$Prog_name: FATAL: option $opt may choose from min|max|avg|loss or number\n"; ++$err; } } return($err); } ################################################################## # ping selects the external or internal, built-in ping method # and starts the external ping program optionally with a # timeout to abort external ping programs that seem to hang # when the target is unreachable. sub ping { my($host, $length, $count, $timeout) = @_; my(%pt); ($pt{min}, $pt{avg}, $pt{max}, $pt{loss}) = ext_ping($host, $length, $count, $timeout); return($pt{min}, $pt{avg}, $pt{max}, $pt{loss}); } ################################################################## # ping host retrieve and return min, avg, max round trip time # relying on finding a standard ping in PATH. # Try to not be platform specific if at all possible. # sub ext_ping { my($host, $length, $count, $timeout) = @_; my(%ping, $ping_output, $redirect_stderr, $pid, %pt); my($alarm_exists); # List of known ping programs %ping = ( 'MSWin32' => "ping -l $length -n $count $host", 'aix' => "/etc/ping $host $length $count", 'bsdos' => "/bin/ping -s $length -c $count $host", 'darwin' => "/sbin/ping -s $length -c $count $host", 'dec_osf' => "/sbin/ping -s $length -c $count $host", 'freebsd' => "/sbin/ping -s $length -c $count $host", 'hpux' => "/etc/ping $host $length $count", 'irix' => "/usr/etc/ping -s $length -c $count $host", 'linux' => "/bin/ping -s $length -c $count $host", 'netbsd' => "/sbin/ping -s $length -c $count $host", 'openbsd' => "/sbin/ping -s $length -c $count $host", 'os2' => "ping $host $length $count", 'OS/2' => "ping $host $length $count", 'solaris' => "/usr/sbin/ping -s $host $length $count", 'sunos' => "/usr/etc/ping -s $host $length $count", ); unless (defined($ping{$Config{'osname'}})) { print STDERR "${Prog_name}: FATAL: Not yet configured for $Config{'osname'}\n"; exit(1); } # add ping options, if any $ping{$Config{'osname'}} =~ s/ / $PingOptions / if $PingOptions; # windows 95/98 does not support stderr redirection... # also OS/2 users reported problems with stderr redirection... $redirect_stderr = $Config{'osname'} =~ /^(MSWin32|os2|OS\/2)$/i ? "" : "2>&1"; # freebsd > 3.x does not allow option -s, # unless we run as root (which we shouldn't) if (($Config{'osname'} =~ /^freebsd$/i) && $>) { # remove option -s from ping command $ping{$Config{'osname'}} =~ s/ -s \d+//; print "$Prog_name: DBG: ext_ping(): ping = ($ping{$Config{'osname'}})\n" if $Debug; } # initialize return values $pt{loss} = 100; $pt{min} = $pt{avg} = $pt{max} = $DeadTime; $ping_output = ""; # finally call the external ping program and read its output: unless ($pid = open(PING, "$ping{$Config{'osname'}} $redirect_stderr |")) { print STDERR "${Prog_name}: FATAL: Can't open $ping{$Config{'osname'}}: $!"; exit(1); } $alarm_exists = eval { alarm(0); 1 }; print STDERR "${Prog_name}: WARN: built-in alarm() does not exist, can't timeout ping command\n" if $Verbose && $timeout && !$alarm_exists; if ($alarm_exists) { # read and timeout ping() if it takes too long... eval { local $SIG{ALRM} = sub { die "alarm\n" }; # \n required! alarm $timeout; while () { $ping_output .= $_; } alarm 0; }; if ($@) { die unless $@ eq "alarm\n"; # propagate unexpected errors # timed out, kill child, get remaining output, ... kill("TERM", $pid); while () { $ping_output .= $_; } unless ($Silent) { print STDERR "${Prog_name}: ERROR: external ping hit timeout $timeout, assuming target $host is unreachable\n"; print STDERR "${Prog_name}: INFO: The output of the ping command $ping{$Config{'osname'}} was:\n"; print STDERR "$ping_output\n"; } } } else { # read and hope that ping() will return in time... while () { $ping_output .= $_; } } # didn't time out, analyze ping output. close(PING); # try to find round trip times if ($ping_output =~ m@(?:round-trip|rtt)(?:\s+\(ms\))?\s+min/avg/max(?:/(?:m|std)-?dev)?\s+=\s+(\d+(?:\.\d+)?)/(\d+(?:\.\d+)?)/(\d+(?:\.\d+)?)@m) { $pt{min} = $1; $pt{avg} = $2; $pt{max} = $3; } elsif ($ping_output =~ m@^\s+\w+\s+=\s+(\d+(?:\.\d+)?)ms,\s+\w+\s+=\s+(\d+(?:\.\d+)?)ms,\s+\w+\s+=\s+(\d+(?:\.\d+)?)ms\s+$@m) { # this should catch most windows locales $pt{min} = $1; $pt{avg} = $3; $pt{max} = $2; } else { unless ($Silent) { print STDERR "${Prog_name}: ERROR: Could not find ping summary for $host\n"; print STDERR "${Prog_name}: INFO: The output of the ping command $ping{$Config{'osname'}} was:\n"; print STDERR "$ping_output\n"; } } # try to find packet loss # ToDo: only if requested?) if ($ping_output =~ m@(\d+)% (?:packet )?loss(?:$|,)@m) { # Unix $pt{loss} = $1; } elsif ($ping_output =~ m@\(perte\s+(\d+)%\),\s+$@m) { # Windows french locale $pt{loss} = $1; } elsif ($ping_output =~ m@\((\d+)%\s+(?:loss|perdidos|persi|de perda|Verlust)\),\s+$@m) { # Windows portugesee, spanish, brazilian, german locale $pt{loss} = $1; } else { unless ($Silent) { print STDERR "${Prog_name}: ERROR: Could not find packet loss summary for $host\n"; print STDERR "${Prog_name}: INFO: The output of the ping command $ping{$Config{'osname'}} was:\n"; print STDERR "$ping_output\n"; } } # If pping timed out, values are still set to 100% loss, and rtt to DeadTime # On windows, 100% loss will still show a rtt of 0, so reset it to DeadTime print "$Prog_name: DBG: ext_ping(): ret-val-mat: $pt{min}, $pt{avg}, $pt{max}, $pt{loss}\n" if $Debug; $pt{min} = $pt{avg} = $pt{max} = $DeadTime if $pt{loss} == 100; print "$Prog_name: DBG: ext_ping(): ret-val-res: $pt{min}, $pt{avg}, $pt{max}, $pt{loss}\n" if $Debug; return($pt{min}, $pt{avg}, $pt{max}, $pt{loss}); } __END__ =head1 NAME mrtg-ping-probe - a round trip time and packet loss probe for MRTG =head1 SYNOPSIS B [ B<-hsvV> ] [ B<-d> I ] [ B<-k> I ] [ B<-l> I ] [ B<-o> I ] [ B<-p> [I*]I/[I*]I ] [ B<-r> I<[rsh:][user@]host[:osname]> ] [ B<-t> I ] I =head1 DESCRIPTION B pings the given host I and prints on stdout two lines extracted from the ping output. The default is to print the maximum, and the minimum round trip time. It is meant to be called by the Multi Router Traffic Grapher (MRTG). =head1 OPTIONS =over 8 =item B<-h> print help on stdout and exit. =item B<-v> Be more verbose. =item B<-V> Print version number on stderr and exit. =item B<-d> I Specifies the value we return for round trip times in case we assume that the target is down. The default is zero. We assume that the target is unreachable, if we cannot find the ping summary or if the ping program was aborted because of a set timeout. For WAN connections that usually have round trip times of 10ms and higher, ranges of zero round trip time are highly visible. In a LAN environment, you might set it to a high value, e.g. 999, which however might change the scale of the graphs in such a way that you hardly see the regular round trip times. You might use mrtg-misc-probe's pong option to generate a graph that shows reachability of targets, instead. =item B<-k> I Specifies the number of of ping packets to be sent. The default is to send 10 ping packets. =item B<-l> I Use I as the length of the data portion of the ICMP ECHO request packet. The default I is 56 data bytes. =item B<-o> I Pass I to the ping program. You can use this generic option to e.g. pass an option to ping to suppress displaying addresses as host names. This helps to prevent the ping to fail because it cannot map hostnames to IP addresses and vice versa. To pass several arguments, enclose the options in quotes. Check the documentation of your ping program for possible options. =item B<-p> [IB<*>]I/[IB<*>]I Pick the values you want mrtg-ping-probe to return. Allowed values for I are: B, B, B, B, or an I. Each item can be preceded by a integer factor used to multiply the value returned by the ping program. The default pick-list is B. To display ping times in microseconds instead of milliseconds, use: B<-p 1000*max/1000*min>. =item B<-r> I<[rsh:][user@]host[:osname]> B run ping on remote host I, as user I (or as local user, if no user is given). Uses B to start program on remote host, unless you provide a different program name. If the remote host has a different system type than the local host (if the osname is different) you have to say so. This option can be used if you run mrtg on a host that cannot ping to the final target, and you cannot install mrtg and/or perl on the intermediate host used to ping the final target. =item B<-s> Silent mode. Do not generate error messages if there is no response from the ping program or if it ran into the timeout. Usually cron will mail you these error messages, which might be helpful to debug problems. =item B<-t> I Abort the external ping program after I seconds. A I value of zero (the default) means, we do not abort the external ping program. If mrtg-ping-probe seems to hang forever, check your ping program, it might be a version that wants to B the given number of ECHO_RESPONSE packets instead of just sending them. If your target is unreachable, these pings ping forever. You want to choose I as short as possible to leave mrtg enough time for all your other targets, but long enough so you do not abort pings (too often). You might use (I * worst case round trip time) as a starting point. (Or install a ping program that is not broken ;-) If your perl installation does not implement the built-in alarm() function, the timeout option will be ignored. You will get a warning about this only in verbose mode (option B<-v>). I have not found a perl installation on Windows that implements the alarm() built-in function on Win32. So basically on Windows the timeout option is not working. =back =head1 RETURN VALUE The program exits with an exit value 0, if it believes it was successful. =head1 EXAMPLES =over 4 =item B Retrieves the maximum and minimum round trip time to the host B, using the default length and count. =item B Retrieves the maximum and average round trip time to the host B, using the default length and count. =item B Retrieves the maximum and average round trip time to the host B multiplied by a factor of 1000, using the default length and count. =item B Retrieves the maximum and minimum round trip time to the host 192.168.192.42, using 17 1000 data bytes pings. =item B Suppress displaying addresses as host names on Solaris 2 (to protect from DNS problems causing the ping to fail) by passing option B<-n> to the ping program. Note that in this example `B<-n>' is not an option for mrtg-ping-probe, but gets passed to the ping program. =item B Pass several options B<-n -I 3> to the ping program. =item B Monitors the packet loss for the link to host ricochet.pwo.de. =back =head1 FILES B uses an external ping program, like F. =head1 SEE ALSO mrtg(1), mrtg-ping-cfg, ping(1), mrtg.cfg-ping, mrtg-misc-probe(1) http://www.mrtg.org/ http://pwo.de/projects/mrtg/ =head1 DIAGNOSTICS =over 4 =item FATAL: Not yet configured for I Currently B depends on an external ping program, which every operating systems hides in another place. Also different programs require different arguments. We have a configuration table listing the ping program for each operating systems. You have to figure out how to call which program on your platform, and add to the information to the table. Please contribute back any additions, so I can include them in the next version. =item ERROR: ignoring superfluous arguments More than one argument was given. B will ignore all but the first argument. The first argument is taken as a hostname or IP address of an host and B will try to ping it. =item FATAL: ping what? No argument was given. B terminates, as there is nothing to ping. =item FATAL: option I