■debian strtchにhttping,smtpping,ioping,dnspingを導入してみる。 $ lsb_release -d Description: Debian GNU/Linux 9.8 (stretch) ■今やicmpを許可する環境も少なくなっていると思う。 RTTを気軽に取得する方法は無いかを探そうとしたのが発端。 $ ping -c 1 -w 5 google.co.jp PING google.co.jp (172.217.11.35) 56(84) bytes of data. --- google.co.jp ping statistics --- 5 packets transmitted, 0 received, 100% packet loss, time 4075ms ■httpingの導入 $ sudo apt-get install -y httping $ httping --version HTTPing v2.5, (C) 2003-2016 folkert@vanheusden.com * SSL support included (-l) * ncurses interface with FFT included (-K) * TFO (TCP fast open) support included (-F) ■HTTPは直接通過しない環境なので。 $ httping --help 2>&1| grep "count\|timeout" -c x / --count how many times to ping -t x / --timeout timeout (default: 30s) $ httping -c 1 -t 5 https://labunix.hateblo.jp Auto enabling SSL due to https-URL PING labunix.hateblo.jp:443 (/): connect time out --- https://labunix.hateblo.jp/ ping statistics --- 1 connects, 0 ok, 100.00% failed, time 6020ms ■プロキシ経由で実行してみる。 $ httping --help 2>&1| grep -A 2 ' \-\-proxy' -x x / --proxy x should be "host:port" which are the network settings of the http/https proxy server. ipv6 ip-address should be "[ip:address]:port" $ httping -c 5 -x 172.31.31.60:8080 https://google.co.jp Auto enabling SSL due to https-URL PING google.co.jp:443 (/): connected to google.co.jp:443 (379 bytes), seq=0 time=366.79 ms connected to google.co.jp:443 (379 bytes), seq=1 time=266.26 ms connected to google.co.jp:443 (379 bytes), seq=2 time=142.35 ms connected to google.co.jp:443 (379 bytes), seq=3 time=145.81 ms connected to google.co.jp:443 (379 bytes), seq=4 time=138.76 ms --- https://google.co.jp/ ping statistics --- 5 connects, 5 ok, 0.00% failed, time 6064ms round-trip min/avg/max = 138.8/212.0/366.8 ms ■「GET」リクエストと「KB/s(可能ならgzipで)」のオプションを追加する。 $ httping --help 2>&1 | grep "\-[BG]" -G / --get-request do a GET request instead of HEAD (read the contents of -b / --show-transfer-speed show transfer speed in KB/s (use with -G) -B / --show-xfer-speed-compressed like -b but use compression if available $ httping -c 5 -G -B -x 172.31.31.60:8080 https://labunix.hateblo.jp Auto enabling SSL due to https-URL PING labunix.hateblo.jp:443 (/): connected to labunix.hateblo.jp:443 (473 bytes), seq=0 time=319.07 ms 126KB/s (not compressed) connected to labunix.hateblo.jp:443 (473 bytes), seq=1 time=183.95 ms 3023KB/s (not compressed) connected to labunix.hateblo.jp:443 (473 bytes), seq=2 time= 94.35 ms 393KB/s (not compressed) connected to labunix.hateblo.jp:443 (473 bytes), seq=3 time=182.32 ms 57KB/s (not compressed) connected to labunix.hateblo.jp:443 (473 bytes), seq=4 time= 89.96 ms 403KB/s (not compressed) --- https://labunix.hateblo.jp/ ping statistics --- 5 connects, 5 ok, 0.00% failed, time 5872ms round-trip min/avg/max = 90.0/173.9/319.1 ms Transfer speed: min/avg/max = 57.979909/800.804883/3023.238095 KB ■送信メールはローカルで実行 メールはキューを使うことからも、即時性を求めるべきでは無いにしても、 メールサーバ自体の正常、異常の判別のためにも、テストしなくて良いわけでは無い。 $ sudo apt-get install -y smtpping $ smtpping -c 3 labunix@localhost PING labunix@localhost ([127.0.0.1]:25): 10300 bytes (SMTP DATA) seq=1, connect=0.30 ms, helo=356.60 ms, mailfrom=387.48 ms, rcptto=432.06 ms, datasent=488.99 ms, quit=489.32 ms seq=2, connect=0.16 ms, helo=1.15 ms, mailfrom=1.34 ms, rcptto=2.48 ms, datasent=52.01 ms, quit=52.54 ms seq=3, connect=0.29 ms, helo=1.36 ms, mailfrom=1.66 ms, rcptto=3.42 ms, datasent=64.35 ms, quit=64.95 ms --- 127.0.0.1 SMTP ping statistics --- 3 e-mail messages transmitted connect min/avg/max = 0.16/0.25/0.30 ms banner min/avg/max = 0.90/119.42/356.36 ms helo min/avg/max = 1.15/119.70/356.60 ms mailfrom min/avg/max = 1.34/130.16/387.48 ms rcptto min/avg/max = 2.48/145.98/432.06 ms data min/avg/max = 2.68/152.85/452.17 ms datasent min/avg/max = 52.01/201.78/488.99 ms quit min/avg/max = 52.54/202.27/489.32 ms $ mail Mail version 8.1.2 01/15/2001. Type ? for help. "/var/mail/labunix": 3 messages 3 new >N 1 Sun Mar 17 19:03 153/10576 SMTP Ping N 2 Sun Mar 17 19:03 153/10576 SMTP Ping N 3 Sun Mar 17 19:03 153/10576 SMTP Ping & q Held 3 messages in /var/mail/labunix ■iopingでディスクのI/O計測。 ボトルネックがディスクかも。 $ sudo apt-get install -y ioping $ ioping -v ioping 0.9 $ ioping -c 4 -s 10MB /tmp/ 10 MiB <<< /tmp/ (ext4 /dev/sda3): request=1 time=107.2 ms (warmup) 10 MiB <<< /tmp/ (ext4 /dev/sda3): request=2 time=104.9 ms 10 MiB <<< /tmp/ (ext4 /dev/sda3): request=3 time=95.5 ms 10 MiB <<< /tmp/ (ext4 /dev/sda3): request=4 time=86.5 ms --- /tmp/ (ext4 /dev/sda3) ioping statistics --- 3 requests completed in 286.9 ms, 30 MiB read, 10 iops, 104.6 MiB/s generated 4 requests in 3.09 s, 40 MiB, 1 iops, 12.9 MiB/s min/avg/max/mdev = 86.5 ms / 95.6 ms / 104.9 ms / 7.50 ms ■dnsping pipやgithubからのパッケージではうまくいかなかった。 stretchではヒットしない。sidではpython3を使っているのでそれに合わせて、 ubuntu用のパッケージを使う。 https://ubuntu.pkgs.org/18.04/ubuntu-universe-amd64/dnsdiag_1.6.3-1_all.deb.html $ apt-cache search dnsdiag | wc -l 0 $ w3m -dump https://packages.debian.org/sid/dnsdiag | grep -A 1 dep dep: python3 interactive high-level object-oriented language (default python3 -- dep: python3-cymruwhois Python library for interfacing with the whois.cymru.com service (Python -- dep: python3-dnspython DNS toolkit for Python 3 $ sudo apt-get install -y python3-pip python3-cymruwhois python3-dnspython $ sudo dpkg -i dnsdiag_1.6.3-1_all.deb $ dpkg -l | awk '/^ii/&&/dnsdiag|python3-pip|python3-cymruwhois|python3-dnspython/{print $2,$3,$4}' dnsdiag 1.6.3-1 all python3-cymruwhois 1.6-2 all python3-dnspython 1.15.0-1+deb9u1 all python3-pip 9.0.1-2 all $ dpkg -L dnsdiag | grep dnsping /usr/bin/dnsping /usr/share/man/man1/dnsping.1.gz ■デフォルトでは「/etc/resolv.conf」内のDNSサーバを使用する。 キャッシュDNSサーバでもあるのでキャッシュが効いているのが分かる。 $ cat /etc/resolv.conf # Dynamic resolv.conf(5) file for glibc resolver(3) generated by resolvconf(8) # DO NOT EDIT THIS FILE BY HAND -- YOUR CHANGES WILL BE OVERWRITTEN nameserver 172.31.31.252 search labunix.net $ whereis dnsping dnsping: /usr/bin/dnsping /usr/share/man/man1/dnsping.1.gz $ dnsping google.co.jp dnsping DNS: 172.31.31.252:53, hostname: google.co.jp, rdatatype: A 36 bytes from 172.31.31.252: seq=0 time=19.185 ms 36 bytes from 172.31.31.252: seq=1 time=3.125 ms 36 bytes from 172.31.31.252: seq=2 time=2.942 ms 36 bytes from 172.31.31.252: seq=3 time=3.961 ms 36 bytes from 172.31.31.252: seq=4 time=4.102 ms 36 bytes from 172.31.31.252: seq=5 time=4.271 ms 36 bytes from 172.31.31.252: seq=6 time=3.445 ms 36 bytes from 172.31.31.252: seq=7 time=2.927 ms 36 bytes from 172.31.31.252: seq=8 time=2.791 ms 36 bytes from 172.31.31.252: seq=9 time=2.727 ms --- 172.31.31.252 dnsping statistics --- 10 requests transmitted, 10 responses received, 0% lost min=2.727 ms, avg=4.948 ms, max=19.185 ms, stddev=5.034 ms $ dnsping -t MX google.co.jp dnsping DNS: 172.31.31.252:53, hostname: google.co.jp, rdatatype: MX 254 bytes from 172.31.31.252: seq=0 time=175.560 ms 254 bytes from 172.31.31.252: seq=1 time=9.610 ms 254 bytes from 172.31.31.252: seq=2 time=8.730 ms 254 bytes from 172.31.31.252: seq=3 time=5.977 ms 254 bytes from 172.31.31.252: seq=4 time=5.658 ms 254 bytes from 172.31.31.252: seq=5 time=5.469 ms 254 bytes from 172.31.31.252: seq=6 time=4.974 ms 254 bytes from 172.31.31.252: seq=7 time=4.959 ms 254 bytes from 172.31.31.252: seq=8 time=4.660 ms 254 bytes from 172.31.31.252: seq=9 time=4.725 ms --- 172.31.31.252 dnsping statistics --- 10 requests transmitted, 10 responses received, 0% lost min=4.660 ms, avg=23.032 ms, max=175.560 ms, stddev=53.620 ms $ dnsping -t MX google.co.jp dnsping DNS: 172.31.31.252:53, hostname: google.co.jp, rdatatype: MX 254 bytes from 172.31.31.252: seq=0 time=6.614 ms 254 bytes from 172.31.31.252: seq=1 time=3.857 ms 254 bytes from 172.31.31.252: seq=2 time=3.929 ms 254 bytes from 172.31.31.252: seq=3 time=3.933 ms 254 bytes from 172.31.31.252: seq=4 time=4.054 ms 254 bytes from 172.31.31.252: seq=5 time=3.892 ms 254 bytes from 172.31.31.252: seq=6 time=4.047 ms 254 bytes from 172.31.31.252: seq=7 time=4.181 ms 254 bytes from 172.31.31.252: seq=8 time=3.896 ms 254 bytes from 172.31.31.252: seq=9 time=3.855 ms --- 172.31.31.252 dnsping statistics --- 10 requests transmitted, 10 responses received, 0% lost min=3.855 ms, avg=4.226 ms, max=6.614 ms, stddev=0.845 ms