FastHandle - IT Operations Examples

FastHandle is fast operation tools for infrastructure configurations and tests.

User Tools

Site Tools


fhscripts:fh:fhping.sh.html



Differences

This shows you the differences between two versions of the page.

Link to this comparison view

Both sides previous revision Previous revision
Next revision
Previous revision
fhscripts:fh:fhping.sh.html [2017/12/02 02:49]
kurihara
fhscripts:fh:fhping.sh.html [2019/02/12 23:21] (current)
kurihara
Line 1: Line 1:
-~~NOTOC~~ 
 [[:index.html#FastHandle Scripts|FastHandle Scripts]] [[:index.html#FastHandle Scripts|FastHandle Scripts]]
-====== fhping.sh - check ping ======+====== script for ping multiple servers (fhping.sh======
  
 +$FHHOME/fhscripts/fhping.sh
 +
 +{{INLINETOC}}
 +\\
  
 ===== About fhping.sh ===== ===== About fhping.sh =====
-fhping.sh is fast ping check tools.+If you want to check connection and ttl, you can use fhping.sh
 +fhping.sh can ping multiple servers. 
  
 \\ \\
 ===== How to use ===== ===== How to use =====
 +
 <sxh bash toolbar:false gutter:false> <sxh bash toolbar:false gutter:false>
-$ fhghost.sh test hosts/test | fhping.sh +$ fhghost  "*"  hosts/test | fhping.sh 
-127.0.0.1 is alive +$ fhping.sh hosts
-192.168.10.1 is alive +
-192.168.10.2 is unreachable+
 </sxh> </sxh>
  
 +
 +\\
 +== Example Output==
 <sxh bash toolbar:false gutter:false> <sxh bash toolbar:false gutter:false>
-$ fhping.sh test.list +~]$ fhping.sh test.txt 
-127.0.0.1 is alive +---------- 192.168.10.1 ping start ---------- 
-192.168.10.1 is alive +PING 192.168.10.1 (192.168.10.1) 56(84) bytes of data. 
-192.168.10.2 is unreachable+64 bytes from 192.168.10.1: icmp_seq=1 ttl=64 time=0.022 ms 
 +64 bytes from 192.168.10.1: icmp_seq=2 ttl=64 time=0.144 ms 
 + 
 +--- 192.168.10.1 ping statistics --- 
 +2 packets transmitted, 2 received, 0% packet loss, time 500ms 
 +rtt min/avg/max/mdev = 0.022/0.083/0.144/0.061 ms 
 +---------- 192.168.10.2 ping start ---------- 
 +PING 192.168.10.2 (192.168.10.2) 56(84) bytes of data. 
 +From 192.168.10.1 icmp_seq=1 Destination Host Unreachable 
 +From 192.168.10.1 icmp_seq=Destination Host Unreachable 
 + 
 +--- 192.168.10.2 ping statistics --- 
 +2 packets transmitted, 0 received, +2 errors, 100% packet loss, time 499ms 
 +pipe 2 
 +####################################### 
 +## NG : ping 192.168.10.2 
 +####################################### 
 +---------- 127.0.0.1 ping start ---------- 
 +PING 127.0.0.1 (127.0.0.1) 56(84) bytes of data. 
 +64 bytes from 127.0.0.1: icmp_seq=1 ttl=64 time=0.094 ms 
 +64 bytes from 127.0.0.1: icmp_seq=2 ttl=64 time=0.023 ms 
 + 
 +--- 127.0.0.1 ping statistics --- 
 +2 packets transmitted, 2 received, 0% packet loss, time 499ms 
 +rtt min/avg/max/mdev = 0.023/0.058/0.094/0.036 ms
 </sxh> </sxh>
  
 \\ \\
 ===== fhping.sh ===== ===== fhping.sh =====
 +
 +$FHHOME/fhscripts/fhping.sh
  
 <sxh bash toolbar:false gutter:false> <sxh bash toolbar:false gutter:false>
Line 33: Line 66:
 # How to use # How to use
 #     fhghost  "*"  hosts/test | fhping.sh #     fhghost  "*"  hosts/test | fhping.sh
-#     echo 192.168.0.10 | fhping.sh +#     fhping.sh hosts
-#     fhping.sh  test.list+
 #================================================ #================================================
  
-if [ -z "$1" ] ; then +for i in `cat $1 |grep -Ev "^#|^$" |awk {'print $1'}
-    grep -Ev "^#|^$" |awk {'print $1'|fping -t 250 2>/dev/null +do 
-else +    echo "---------- $i ping start ----------" 
-    cat "$1|grep -Ev "^#|^$" |awk {'print $1'} |fping -t 250 2>/dev/null +    ping -i 0.5 -$i 
-fi+    if [ "$?" -ne 0 ] ; then 
 +        echo "#### NG : ping $i ####
 +    fi 
 +done
  
 +exit
 </sxh> </sxh>
 +
 +
  
  
Line 49: Line 87:
 \\ \\
 <WRAP box 90%> <WRAP box 90%>
-<catlist -noAddPageButton -smallHead -sortAscending>+<catlist ..: -noAddPageButton -smallHead -sortAscending>
 </WRAP> </WRAP>
 \\ \\
 \\ \\
 [[:index.html#FastHandle Scripts|FastHandle Scripts]] [[:index.html#FastHandle Scripts|FastHandle Scripts]]


fhscripts/fh/fhping.sh.html.1512150574.txt.gz · Last modified: 2017/12/02 02:49 by kurihara