pingfailtest

raw

pingfailtest.sh

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
#!/bin/sh
check() {
    ok=1
    firstfail=
    lastfail=
    while read data
    do
        case "$data" in
            *"no answer yet"*)
                #fail
                if [ "$ok" = 1 ]; then
                    ok=0
                    firstfail=$(time "$data")
                    lastfail=
                    echo -n "Fail: $firstfail"
                fi
                #echo fail
                lastfail=$(time "$data")
                ;;
            *"bytes from"*)
                #ok
                if [ "$ok" = 0 ]; then
                    echo " to $lastfail"
                    firstfail=
                    ok=1
                fi
                ;;
            PING*)
                echo "ping fail test start"
                echo "$data"
                ;;
        esac
        #echo $(time "$data")
    done
}
 
time() {
    echo "$1"\
    | cut -b2-11\
    | xargs -I '%TSTAMP%' date -u --date="1970-01-01 %TSTAMP% sec GMT" "+%H:%M:%S"
}
 
#cat failtestdata | check
ping -nOD $1 2>&1 | check
 
raw

z-failtestdata.txt

[1452682591.205924] 64 bytes from 192.168.178.251: icmp_seq=1757 ttl=64 time=0.356 ms
[1452682592.205836] 64 bytes from 192.168.178.251: icmp_seq=1758 ttl=64 time=0.368 ms
[1452682593.205831] 64 bytes from 192.168.178.251: icmp_seq=1759 ttl=64 time=0.324 ms
[1452682595.205521] no answer yet for icmp_seq=1760
[1452682596.205491] no answer yet for icmp_seq=1761
[1452682597.205475] no answer yet for icmp_seq=1762
[1452682598.205426] no answer yet for icmp_seq=1763
[1452682599.205484] no answer yet for icmp_seq=1764
[1452682600.205413] no answer yet for icmp_seq=1765
[1452682601.205477] no answer yet for icmp_seq=1766
[1452682602.205415] no answer yet for icmp_seq=1767
[1452682603.205469] no answer yet for icmp_seq=1768
[1452682604.205461] no answer yet for icmp_seq=1769
[1452682605.205530] no answer yet for icmp_seq=1770
[1452682606.205528] no answer yet for icmp_seq=1771
[1452682607.205441] no answer yet for icmp_seq=1772
[1452682608.205471] no answer yet for icmp_seq=1773
[1452682609.205482] no answer yet for icmp_seq=1774
[1452682610.205477] no answer yet for icmp_seq=1775
[1452682611.205426] no answer yet for icmp_seq=1776
[1452682612.205467] no answer yet for icmp_seq=1777
[1452682613.207178] no answer yet for icmp_seq=1778
[1452682613.207770] 64 bytes from 192.168.178.251: icmp_seq=1779 ttl=64 time=0.507 ms
[1452682614.208332] 64 bytes from 192.168.178.251: icmp_seq=1780 ttl=64 time=0.330 ms
[1452682615.207303] 64 bytes from 192.168.178.251: icmp_seq=1781 ttl=64 time=0.296 ms
[1452682824.225831] 64 bytes from 192.168.178.251: icmp_seq=1990 ttl=64 time=0.261 ms
[1452682825.225843] 64 bytes from 192.168.178.251: icmp_seq=1991 ttl=64 time=0.274 ms
[1452682827.225524] no answer yet for icmp_seq=1992
[1452682828.225469] no answer yet for icmp_seq=1993
[1452682829.225526] no answer yet for icmp_seq=1994
[1452682830.225525] no answer yet for icmp_seq=1995
[1452682831.225526] no answer yet for icmp_seq=1996
[1452682832.225422] no answer yet for icmp_seq=1997
[1452682833.225470] no answer yet for icmp_seq=1998
[1452682834.225479] no answer yet for icmp_seq=1999
[1452682835.225483] no answer yet for icmp_seq=2000
[1452682836.225525] no answer yet for icmp_seq=2001
[1452682837.225494] no answer yet for icmp_seq=2002
[1452682838.229432] no answer yet for icmp_seq=2003
[1452682839.229522] no answer yet for icmp_seq=2004
[1452682840.229479] no answer yet for icmp_seq=2005
[1452682841.229541] no answer yet for icmp_seq=2006
[1452682842.229528] no answer yet for icmp_seq=2007
[1452682843.229524] no answer yet for icmp_seq=2008
[1452682844.229480] no answer yet for icmp_seq=2009
[1452682845.229518] no answer yet for icmp_seq=2010
[1452682846.229473] no answer yet for icmp_seq=2011
[1452682847.229475] no answer yet for icmp_seq=2012
[1452682848.229525] no answer yet for icmp_seq=2013
[1452682849.229464] no answer yet for icmp_seq=2014
[1452682850.229458] no answer yet for icmp_seq=2015
[1452682851.229532] no answer yet for icmp_seq=2016
[1452682852.229521] no answer yet for icmp_seq=2017
[1452682853.229491] no answer yet for icmp_seq=2018
[1452682854.229531] no answer yet for icmp_seq=2019
[1452682855.229532] no answer yet for icmp_seq=2020
[1452682856.229489] no answer yet for icmp_seq=2021
[1452682857.229530] no answer yet for icmp_seq=2022
[1452682857.229834] 64 bytes from 192.168.178.251: icmp_seq=2023 ttl=64 time=0.227 ms
[1452682858.233779] 64 bytes from 192.168.178.251: icmp_seq=2024 ttl=64 time=0.331 ms
[1452682859.233901] 64 bytes from 192.168.178.251: icmp_seq=2025 ttl=64 time=0.377 ms
[1452682860.233010] 64 bytes from 192.168.178.251: icmp_seq=2026 ttl=64 time=0.256 ms
[1452682861.232298] 64 bytes from 192.168.178.251: icmp_seq=2027 ttl=64 time=0.511 ms
[1452682896.229878] 64 bytes from 192.168.178.251: icmp_seq=2062 ttl=64 time=0.363 ms
[1452682897.230044] 64 bytes from 192.168.178.251: icmp_seq=2063 ttl=64 time=0.522 ms
[1452682899.233484] no answer yet for icmp_seq=2064
[1452682900.233478] no answer yet for icmp_seq=2065
[1452682901.233526] no answer yet for icmp_seq=2066
[1452682902.233521] no answer yet for icmp_seq=2067
[1452682903.233432] no answer yet for icmp_seq=2068
[1452682904.233532] no answer yet for icmp_seq=2069
[1452682905.233478] no answer yet for icmp_seq=2070
[1452682906.233469] no answer yet for icmp_seq=2071
[1452682907.233417] no answer yet for icmp_seq=2072
[1452682908.233474] no answer yet for icmp_seq=2073
[1452682909.233470] no answer yet for icmp_seq=2074
[1452682910.233526] no answer yet for icmp_seq=2075
[1452682911.233480] no answer yet for icmp_seq=2076
[1452682969.233474] no answer yet for icmp_seq=2134
[1452682970.233529] no answer yet for icmp_seq=2135
[1452682971.233468] no answer yet for icmp_seq=2136
[1452682971.234144] 64 bytes from 192.168.178.251: icmp_seq=2137 ttl=64 time=0.529 ms
[1452682972.234083] 64 bytes from 192.168.178.251: icmp_seq=2138 ttl=64 time=0.524 ms
[1452682973.234084] 64 bytes from 192.168.178.251: icmp_seq=2139 ttl=64 time=0.523 ms
[1452682974.234026] 64 bytes from 192.168.178.251: icmp_seq=2140 ttl=64 time=0.509 ms
Christian Weiske Christian Weiske
owner

History