This article provides information about a script that can be used to display the time stamp, along with the ping result.
At times, for troubleshooting purposes, it is useful to keep track of the time stamps of ICMP packets. It has other options, such as writing output to a log file. A quick reference guide is coded into the script.
Usage of script:
user1@kobato:script% sh pingcust.sh -h
Name:
pingcust.sh (ping with time stamp)
Synopsis:
pingcust.sh [dlstpw] [-l logical_system] [-s source] [-p packet_size] [-w log_file] host
Options:
- -d: debug mode
- -l <logical_system>: binds the logical system
- -p <packet size>: packet size in bytes
- -s <source ip>: binds the source IP address
- -t: displays only the actual Junos command and debug message
- -w <file>: writes the output to a file.
Sample output:
% sh pingcust.sh -d -w log.txt -s 50.50.50.1 10.10.10.2
Actual Junos command:
ping count 1 rapid source 50.50.50.1 10.10.10.2
Logging:
enabled, log.txt -------------------------------------------------- 2012/08/21 12:51:13 ping result OK 2012/08/21 12:51:14 ping result OK 2012/08/21 12:51:15 ping result OK ^C % cat log.txt 2012/08/21 12:51:13 ping result OK 2012/08/21 12:51:14 ping result OK 2012/08/21 12:51:15 ping result OK