Skip to content

Instantly share code, notes, and snippets.

@yvt
Created February 7, 2014 10:04
Show Gist options
  • Save yvt/8860063 to your computer and use it in GitHub Desktop.
Save yvt/8860063 to your computer and use it in GitHub Desktop.
Pingのパケット損失率をパケットサイズごとの表にしてCSV出力するスクリプト (要root)
#!/bin/sh
# 出力ファイル
OUT=/tmp/ping-test-out.csv
# ホスト名 (適宜変えてね)
HOST=www.google.com
echo "ping-test to ${HOST}" > "$OUT"
for siz in `seq 50 50 1500`; do
echo "size = ${siz}"
resline=`ping -s ${siz} -D -c 300 -f -q "$HOST" | grep -o '[0-9.]*\%'`
outline="${siz},${resline}"
echo "$outline"
echo "$outline" >> "$OUT"
done
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment