egrep,awk,cut,sedコマンドによる文字列操作の見直し。
仕事でよく使うコマンドなので、改めてレビューしてみる。

セキュリティログを確認
■AND検索

AWS$cat secure-20120826 | egrep -i "Invalid user.*from" | head
Aug 19 12:56:05 aws sshd[31397]: Invalid user db2inst1 from 123.15.36.218
Aug 19 12:56:08 aws sshd[31401]: Invalid user prueba from 123.15.36.218
Aug 19 12:56:12 aws sshd[31405]: Invalid user postgres from 123.15.36.218
Aug 19 12:56:19 aws sshd[31413]: Invalid user mythtv from 123.15.36.218
Aug 19 12:56:26 aws sshd[31421]: Invalid user mmroot from 123.15.36.218
Aug 19 12:56:33 aws sshd[31429]: Invalid user x from 123.15.36.218
Aug 19 12:56:38 aws sshd[31433]: Invalid user rob from 123.15.36.218
Aug 19 12:56:47 aws sshd[31443]: Invalid user tommy from 123.15.36.218
Aug 19 12:57:12 aws sshd[31467]: Invalid user www from 123.15.36.218
Aug 19 12:57:19 aws sshd[31475]: Invalid user nagios from 123.15.36.218
AWS$

and

■OR検索

AWS$cat secure-20120826 | egrep -i "postgres|nagios" | head
Aug 19 12:56:12 aws sshd[31405]: Invalid user postgres from 123.15.36.218
Aug 19 12:56:12 aws sshd[31406]: input_userauth_request: invalid user postgres
Aug 19 12:57:19 aws sshd[31475]: Invalid user nagios from 123.15.36.218
Aug 19 12:57:19 aws sshd[31476]: input_userauth_request: invalid user nagios
Aug 19 13:01:23 aws sshd[31714]: Invalid user nagios from 123.15.36.218
Aug 19 13:01:23 aws sshd[31715]: input_userauth_request: invalid user nagios
Aug 19 13:10:16 aws sshd[32250]: Invalid user nagios from 123.15.36.218
Aug 19 13:10:16 aws sshd[32251]: input_userauth_request: invalid user nagios
Aug 25 06:11:34 aws sshd[4726]: Invalid user nagios from 221.13.104.162
Aug 25 06:11:34 aws sshd[4727]: input_userauth_request: invalid user nagios
AWS$

or

■awkにて特定列抽出

AWS$cat secure-20120826 | egrep -i "Invalid user.*from" | awk '{print $8}' | head
db2inst1
prueba
postgres
mythtv
mmroot
x
rob
tommy
www
nagios
AWS$ 

■awkで抽出したデータから同じ値を纏めて合計を表示して多い順に表示する。

AWS$cat secure-20120826 | egrep -i "Invalid user.*from" | awk '{print $8}' | sort | uniq -c | sort -nr
     19 oracle
     12 nagios
     10 mythtv
      7 test
      6 user0
      6 info
      5 test1
      5 backup
      4 testuser
      4 jack
      4 i-heart
[省略...]

AWS$ 

awk

■awkにてIPのみ抽出

AWS$cat secure-20120826 | egrep -i "Invalid user.*from" | awk '{print $10}' | head
123.15.36.218
123.15.36.218
123.15.36.218
123.15.36.218
123.15.36.218
123.15.36.218
123.15.36.218
123.15.36.218
123.15.36.218
123.15.36.218

■awkにてIPのみ抽出して合計が多い順に並べる

AWS$ cat secure-20120826 | egrep -i "Invalid user.*from" | awk '{print $10}' | sort | uniq -c | sort -nr
    174 123.15.36.218
     51 141.89.97.171
     49 221.13.104.162
      7 101.44.1.134
      4 140.120.90.196
      1 187.16.247.187
      1 183.59.9.150
AWS$

cat

※何処からログインを試みているか念の為確認。
access

■awkにてwebログから日付を抽出

AWS$cat access_log-20120826 |  awk '{print $4,$5}' | head
[19/Aug/2012:03:41:49 +0900]
[19/Aug/2012:03:41:49 +0900]
[19/Aug/2012:03:41:50 +0900]
[19/Aug/2012:06:23:22 +0900]
[19/Aug/2012:06:23:22 +0900]
[19/Aug/2012:06:56:52 +0900]
[19/Aug/2012:06:56:52 +0900]
[19/Aug/2012:08:07:44 +0900]
[19/Aug/2012:08:07:44 +0900]
[19/Aug/2012:12:52:29 +0900]
AWS$

■awkにてwebログから特定の列を抽出してから、cutコマンドで特定文字のみを抜き出す。

AWS$cat access_log-20120826 |  awk '{print $4}' | head
[19/Aug/2012:03:41:49
[19/Aug/2012:03:41:49
[19/Aug/2012:03:41:50
[19/Aug/2012:06:23:22
[19/Aug/2012:06:23:22
[19/Aug/2012:06:56:52
[19/Aug/2012:06:56:52
[19/Aug/2012:08:07:44
[19/Aug/2012:08:07:44
[19/Aug/2012:12:52:29
AWS$
AWS$cat access_log-20120826 |  awk '{print $4}' | cut -c 2-12 | head
19/Aug/2012
19/Aug/2012
19/Aug/2012
19/Aug/2012
19/Aug/2012
19/Aug/2012
19/Aug/2012
19/Aug/2012
19/Aug/2012
19/Aug/2012
AWS$ 

cut

■awkにてwebログから特定の列を抽出してから、cutコマンドで時間のみを抜き出す。

AWS$cat access_log-20120826 |  awk '{print $4,$5}' | cut -d: -f 2-3 | head
03:41
03:41
03:41
06:23
06:23
06:56
06:56
08:07
08:07
12:52
AWS$

■awkにて特定列の抽出後にcutにて特定範囲のみを抜き出しsed特定文字を入れ替える。

AWS$cat access_log-20120826 |  awk '{print $4}' | cut -c 2-12 | head
19/Aug/2012
19/Aug/2012
19/Aug/2012
19/Aug/2012
19/Aug/2012
19/Aug/2012
19/Aug/2012
19/Aug/2012
19/Aug/2012
19/Aug/2012
AWS$

■sedにて/をtabにて入れ替え

AWS$cat access_log-20120826 |  awk '{print $4}' | cut -c 2-12 | sed -e 's/\//\t/g' | head
19      Aug     2012
19      Aug     2012
19      Aug     2012
19      Aug     2012
19      Aug     2012
19      Aug     2012
19      Aug     2012
19      Aug     2012
19      Aug     2012
19      Aug     2012
AWS$

sed

■awkその他集計等

[root@HOME001 log]# cat number_cout | awk '{ print $1}'
1
2
3
4
5
6
7
8
9
10
[root@HOME001 log]# cat number_cout | awk '{ sum += $1 } END { print sum }'
55
[root@HOME001 log]# cat number_cout | awk '{ sum += $1; num++ } END { print "sum = " sum; print "average = " sum/num }'         
sum = 55
average = 5.5
[root@HOME001 log]#

参考サイト:
【 sed 】 文字列の置換,行の削除を行う


WiresharkはGUIベースですが、コマンド版でtsharkが準備されています。
LinuxのCUIで利用する場合や、バッチ連携したりGUIだと重いと言った場合に便利かもしれません。

[root@CentOS64VM tools]# yum install wireshark
Loaded plugins: fastestmirror, presto
Determining fastest mirrors
 * base: ftp.jaist.ac.jp
 * extras: ftp.jaist.ac.jp
 * updates: ftp.jaist.ac.jp
base
extras
updates
updates/primary_db
Setting up Install Process
Resolving Dependencies
--> Running transaction check
---> Package wireshark.x86_64 0:1.2.15-2.el6_2.1 will be installed
--> Processing Dependency: libgnutls.so.26(GNUTLS_1_4)(64bit) for package: wireshark-1.2.15-2.el6_2.1.x86_64
--> Processing Dependency: libsmi.so.2()(64bit) for package: wireshark-1.2.15-2.el6_2.1.x86_64
--> Processing Dependency: libpcap.so.1()(64bit) for package: wireshark-1.2.15-2.el6_2.1.x86_64
--> Processing Dependency: libgnutls.so.26()(64bit) for package: wireshark-1.2.15-2.el6_2.1.x86_64
--> Running transaction check
---> Package gnutls.x86_64 0:2.8.5-4.el6_2.2 will be installed
--> Processing Dependency: libtasn1.so.3(LIBTASN1_0_3)(64bit) for package: gnutls-2.8.5-4.el6_2.2.x86_64
--> Processing Dependency: libtasn1.so.3()(64bit) for package: gnutls-2.8.5-4.el6_2.2.x86_64
---> Package libpcap.x86_64 14:1.0.0-6.20091201git117cb5.el6 will be installed
---> Package libsmi.x86_64 0:0.4.8-4.el6 will be installed
--> Running transaction check
---> Package libtasn1.x86_64 0:2.3-3.el6_2.1 will be installed
--> Finished Dependency Resolution

wireshark

tsharkとtcpdumpでのパケットキャプチャー

[root@CentOS64VM tools]# /usr/sbin/tshark -n -i eth0 tcp port 80
Running as user "root" and group "root". This could be dangerous.
Capturing on eth0
  0.000000 192.168.137.1 -> 192.168.137.128 TCP 50018 > 80 [SYN] Seq=0 Win=8192 Len=0 MSS=1460 WS=2
  0.114130 192.168.137.1 -> 192.168.137.128 TCP 50019 > 80 [SYN] Seq=0 Win=8192 Len=0 MSS=1460 WS=2
  0.250229 192.168.137.1 -> 192.168.137.128 TCP 50020 > 80 [SYN] Seq=0 Win=8192 Len=0 MSS=1460 WS=2
  2.999452 192.168.137.1 -> 192.168.137.128 TCP 50018 > 80 [SYN] Seq=0 Win=8192 Len=0 MSS=1460 WS=2
  3.111388 192.168.137.1 -> 192.168.137.128 TCP 50019 > 80 [SYN] Seq=0 Win=8192 Len=0 MSS=1460 WS=2
  3.251262 192.168.137.1 -> 192.168.137.128 TCP 50020 > 80 [SYN] Seq=0 Win=8192 Len=0 MSS=1460 WS=2
^C6 packets captured
[root@CentOS64VM tools]# /usr/sbin/tcpdump -n -i eth0 port 80
tcpdump: verbose output suppressed, use -v or -vv for full protocol decode
listening on eth0, link-type EN10MB (Ethernet), capture size 65535 bytes
19:24:35.773723 IP 192.168.137.1.50022 > 192.168.137.128.http: Flags [S], seq 3779509450, win 8192, options [mss 1460,nop,wscale 2,nop
19:24:36.784314 IP 192.168.137.1.50023 > 192.168.137.128.http: Flags [S], seq 1774179078, win 8192, options [mss 1460,nop,wscale 2,nop
19:24:37.055527 IP 192.168.137.1.50024 > 192.168.137.128.http: Flags [S], seq 1893589663, win 8192, options [mss 1460,nop,wscale 2,nop
19:24:39.783694 IP 192.168.137.1.50023 > 192.168.137.128.http: Flags [S], seq 1774179078, win 8192, options [mss 1460,nop,wscale 2,nop
19:24:40.063879 IP 192.168.137.1.50024 > 192.168.137.128.http: Flags [S], seq 1893589663, win 8192, options [mss 1460,nop,wscale 2,nop
19:24:41.795255 IP 192.168.137.1.50022 > 192.168.137.128.http: Flags [S], seq 3779509450, win 8192, options [mss 1460,nop,nop,sackOK],
^C
6 packets captured
6 packets received by filter
0 packets dropped by kernel
[root@CentOS64VM tools]#

tshark

[root@CentOS64VM tools]# /usr/sbin/tshark -help
TShark 1.2.15
Dump and analyze network traffic.
See http://www.wireshark.org for more information.

Copyright 1998-2011 Gerald Combs and contributors.
This is free software; see the source for copying conditions. There is NO
warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.

Usage: tshark [options] …

Capture interface:
-i name or idx of interface (def: first non-loopback)
-f packet filter in libpcap filter syntax
-s packet snapshot length (def: 65535)
-p don’t capture in promiscuous mode
-y link layer type (def: first appropriate)
-D print list of interfaces and exit
-L print list of link-layer types of iface and exit

Capture stop conditions:
-c stop after n packets (def: infinite)
-a … duration:NUM – stop after NUM seconds
filesize:NUM – stop this file after NUM KB
files:NUM – stop after NUM files
Capture output:
-b … duration:NUM – switch to next file after NUM secs
filesize:NUM – switch to next file after NUM KB
files:NUM – ringbuffer: replace after NUM files
Input file:
-r set the filename to read from (no pipes or stdin!)

Processing:
-R packet filter in Wireshark display filter syntax
-n disable all name resolutions (def: all enabled)
-N enable specific name resolution(s): “mntC”
-d ==,
“Decode As”, see the man page for details
Example: tcp.port==8888,http
Output:
-w set the output filename (or ‘-‘ for stdout)
-C start with specified configuration profile
-F set the output file type, default is libpcap
an empty “-F” option will list the file types
-V add output of packet tree (Packet Details)
-S display packets even when writing to a file
-x add output of hex and ASCII dump (Packet Bytes)
-T pdml|ps|psml|text|fields
format of text output (def: text)
-e field to print if -Tfields selected (e.g. tcp.port);
this option can be repeated to print multiple fields
-E= set options for output when -Tfields selected:
header=y|n switch headers on and off
separator=/t|/s| select tab, space, printable character as separator
quote=d|s|n select double, single, no quotes for values
-t ad|a|r|d|dd|e output format of time stamps (def: r: rel. to first)
-l flush standard output after each packet
-q be more quiet on stdout (e.g. when using statistics)
-X : eXtension options, see the man page for details
-z various statistics, see the man page for details

Miscellaneous:
-h display this help and exit
-v display version info and exit
-o : … override preference setting
-K keytab file to use for kerberos decryption
[root@CentOS64VM tools]#

関連ページ
Wireshark (旧 Ethereal)によるネットワーク解析

参考ページ
tshark (WiresharkのCLI版) の使い方
WireSharkの裏技 〜 コマンドラインで実行できる「TShark」
tcpdump ネットワーク上を流れるパケットを監視する


fizzbuzz
知人がfizzbuzzの話をしていたので、
最近手をつけてないプログラムの頭を少し使ってみました。
通常は2~5分で解かなければいけないのですが、
普段開発してないので時間がかかってしまいました。

最初のプレイヤーは「1」と数字を発言する。
次のプレイヤーは直前のプレイヤーの次の数字を発言していく。
ただし、3で割り切れる場合は 「Fizz」(Bizz Buzz の場合は 「Bizz」)、
5で割り切れる場合は 「Buzz」、両者で割り切れる場合は 「Fizz Buzz」
を数の代わりに発言しなければならない。


#include

int main(void)
{
int i;

for (i = 1; i <= 100; i++) { printf("%d\r", i); if (i % 3 == 0) printf("Fizz"); if (i % 5 == 0) printf("Buzz"); printf("\n"); } return 0; } [/C] C

#!/usr/bin/perl
for (1..100) {
    if ($_ % 3 == 0 && $_ % 5 == 0) { print 'FizzBuzz'; }
    elsif ($_ % 3 == 0) { print 'Fizz'; }
    elsif ($_ % 5 == 0) { print 'Buzz'; }
    else { print $_; }
    print "\n";
}

perl

 perl -e'for(1..100){my$s;$s=Fizz if$_%3==0;$s.=Buzz if$_%5==0;print$s?"$s\n":"$_\n"}'

oneliner

参考サイト
FizzBuzz
Fizz Buzz Wiki
FizzBuzz を試してみた
変数の種類を理解する


FREE、TOPなどでもシステム状況を把握して問題解決やリソースのプランニングが可能だが、
他にもいくつか参考になるコマンドがあるのでメモ。

CPU使用率TOP10
ps auxw | sort -k3 -nr | head -n 10
cpu利用率

MEM使用率TOP10
ps auxw | sort -k4 -nr | head -n 10
mem利用率

パフォーマンス確認に便利なdstat
Usage: dstat [-afv] [options..] [delay [count]]

インストール
[root@ip-xx-xxx-xx-xxx ec2-user]# yum install dstat
Loaded plugins: fastestmirror, priorities, security, update-motd
Loading mirror speeds from cached hostfile
* amzn-main: packages.ap-northeast-1.amazonaws.com
* amzn-updates: packages.ap-northeast-1.amazonaws.com
amzn-main | 2.1 kB 00:00
amzn-updates | 2.3 kB 00:00
Setting up Install Process
Resolving Dependencies
–> Running transaction check
—> Package dstat.noarch 0:0.7.0-1.5.amzn1 will be installed
–> Finished Dependency Resolution

Dependencies Resolved

=======================================================================================
Package Arch Version Repository Size
=======================================================================================
Installing:
dstat noarch 0.7.0-1.5.amzn1 amzn-main 182 k

Transaction Summary
=======================================================================================
Install 1 Package(s)

Total download size: 182 k
Installed size: 660 k
Is this ok [y/N]: y
Downloading Packages:
dstat-0.7.0-1.5.amzn1.noarch.rpm | 182 kB 00:00
Running rpm_check_debug
Running Transaction Test
Transaction Test Succeeded
Running Transaction
Installing : dstat-0.7.0-1.5.amzn1.noarch 1/1

Installed:
dstat.noarch 0:0.7.0-1.5.amzn1

Complete!
[root@ip-xx-xxx-xx-xxx ec2-user]#

dstat –top-bioで最もブロックI/Oしているプロセス確認。
dstat –top-ioで最もI/Oが多いプロセスを確認。

[root@ip-xx-xxx-xx-xxx ec2-user]# dstat --top-bio
—-most-expensive—-
block i/o process
init 66k 726B

[root@ip-xx-xxx-xx-xxx ec2-user]# dstat --top-io
—-most-expensive—-
i/o process
bash 82k 1351B
sshd: ec2-u 146B 248B
sshd: ec2-u 78B 168B
sshd: ec2-u 78B 168B
sshd: ec2-u 78B 168B
sshd: ec2-u 78B 168B
sshd: ec2-u 78B 168B

dstat –tcp でTCPコネクション確認
dstat –net でネットワーク確認

[ip-xx-xxx-xx-xxx]#dstat --tcp --net

net状態

[root@ip-xx-xxx-xx-xxx ec2-user]# dstat --top-cpu
-most-expensive-
cpu process
httpd 0.1
mysqld 1.0

[root@ip-xx-xxx-xx-xxx ec2-user]# dstat --net
-net/total-
recv send
0 0
80B 308B
40B 260B
40B 260B
40B 260B
40B 260B
5925B 35k
1710B 24k
4120B 37k
256B 298B
40B 154B
[root@ip-xx-xxx-xx-xxx ec2-user]#

CPUとネットの状況を同時に確認

[root@ip-xx-xxx-xx-xxx ec2-user]# dstat -a
—-total-cpu-usage—- -dsk/total- -net/total- —paging– —system–
usr sys idl wai hiq siq| read writ| recv send| in out | int csw
1 0 98 0 0 0| 92k 12k| 0 0 | 0 0 | 36 66
0 0 100 0 0 0| 0 0 | 80B 916B| 0 0 | 20 46
0 0 100 0 0 0| 0 0 | 40B 452B| 0 0 | 18 44
0 0 100 0 0 0| 0 0 | 40B 452B| 0 0 | 18 46
0 0 100 0 0 0| 0 0 | 40B 452B| 0 0 | 20 46
0 0 100 0 0 0| 0 0 | 40B 452B| 0 0 | 19 47
0 0 100 0 0 0| 0 0 | 40B 452B| 0 0 | 16 42
0 0 100 0 0 0| 0 0 | 40B 452B| 0 0 | 19 46
1 0 99 0 0 0| 0 0 | 40B 452B| 0 0 | 18 43
[root@ip-xx-xxx-xx-xxx ec2-user]#

-a, --all equals -cdngy (default)
all

dtatオプション

[ip-xx-xxx-xx-xxx]#dstat –help
Usage: dstat [-afv] [options..] [delay [count]]
Versatile tool for generating system resource statistics

Dstat options:
-c, –cpu enable cpu stats
-C 0,3,total include cpu0, cpu3 and total
-d, –disk enable disk stats
-D total,hda include hda and total
-g, –page enable page stats
-i, –int enable interrupt stats
-I 5,eth2 include int5 and interrupt used by eth2
-l, –load enable load stats
-m, –mem enable memory stats
-n, –net enable network stats
-N eth1,total include eth1 and total
-p, –proc enable process stats
-r, –io enable io stats (I/O requests completed)
-s, –swap enable swap stats
-S swap1,total include swap1 and total
-t, –time enable time/date output
-T, –epoch enable time counter (seconds since epoch)
-y, –sys enable system stats

–aio enable aio stats
–fs, –filesystem enable fs stats
–ipc enable ipc stats
–lock enable lock stats
–raw enable raw stats
–socket enable socket stats
–tcp enable tcp stats
–udp enable udp stats
–unix enable unix stats
–vm enable vm stats

–plugin-name enable plugins by plugin name (see manual)
–list list all available plugins

-a, –all equals -cdngy (default)
-f, –full automatically expand -C, -D, -I, -N and -S lists
-v, –vmstat equals -pmgdsc -D total

–bw, –blackonwhite change colors for white background terminal
–float force float values on screen
–integer force integer values on screen
–nocolor disable colors (implies –noupdate)
–noheaders disable repetitive headers
–noupdate disable intermediate updates
–output file write CSV output to file

delay is the delay in seconds between each update (default: 1)
count is the number of updates to display before exiting (default: unlimited)

[ip-xx-xxx-xx-xxx]#

上記オプションを適切に使い分けて、最適なシステム状況診断と
対応が出来るようにしておくと良さそうです。

dstat --cpu --mem --disk --page --int --load --net
general

dstat -N eth0
interface

dstat --time --proc --swap --sys --ipc
date

dstat --full
full

dstat --vmstat
vmstat


--integer 整数値を表示します
--nocolor カラー表示を無効にします
--noheaders ヘッダー表示を無効にします
--noupdate 仲介更新を無効にします
--output file 出力結果を CSV ファイルに書き出します

参考
Dstat: Versatile resource statistics tool


サーバーを購入したり、ディスク交換や追加した場合に、
単純にI/O性能を測る事が出来るツールを確認。
前回は、Linuxのhdparmを検証しました。

CrystalDiskMark

ダウンロードページ
2012年2月12日[7/2008/Vista/2003/XP/2000, x86/x64, i18n]
http://crystalmark.info/download/index.html#CrystalDiskMark

インストールしないでもベンチマーク出来る方が、
何処でも利用出来て敷居が低いのでポータブル版をダウンロードして利用。

ダウンロードして展開
展開

実行ファイルをクリック(32bit/64bit版)
実行

対象ディスクの選択

ローカルディスクで実行
ローカル

外部SDカードで実行

それぞれのテストは100MBのファイル設定で2回ずつ実行。(Defaultは5回実行)
テストループ回数は多い程、サンプリングデータが増えてより正確なデータを得る
事が出来ると考える。


http-pingは、ICMPの代わりにhttp/sを利用してコンピュータ名や
IPアドレスの変わりにURLを利用してレスポンスを返します。 (IPv6にも対応)

It is similar to the popular ping utility, but works over HTTP/S
instead of ICMP, and with a URL instead of a computer name/IP address.
http-ping supports IPv6 addresses.

Ping any URL or web site with our free command-line utility, http-ping

http-pingをダウンロードしたら,exeをそのままフォルダーに配置して
何もインストールしないでそのまま実行ファイルとして利用出来ます。

http-ping

For each request, http-ping displays:

The HTTP return code (and its brief textual description)
The number of bytes returned by the server (excluding headers)
The time taken to complete the request (i.e. round-trip time)

A summary of all the requests is presented upon completion.


C:\tools\http-ping>http-ping.exe /?

http-ping
=========

Synopsis: Pings a specified URL.

Usage: http-ping [-t] [-n count] [-i interval] [-f file-name] [-s] [-v]
[-q] [-c] [-r] [-w timeout] [-d] [-o data | -of file-name] URL

Where:
URL The URL you wish to check. For example http://www.kiva.org,
http://209.191.122.70, or http://www.yourhost:8080.
Be sure to surround an IPv6 address with square brackets,
for example, http://[2a00:1450:4007:800::1014].

Options:
-t Ping the specified URL until stopped.
To see statistics and continue - type Control-Break;
To stop - type Control-C.
-n count Send 'count' requests. Supercedes -t.
-i interval Wait 'interval' seconds between each request. There is a
1-second wait if this option is not specified.
-f file-name Save responses to file 'file-name'. Please specify the full
path, and use quotes if the file name contains spaces.
-s Silent. Print no output.
-v Verbose. Print detailed output. Supercedes -s.
-q Quick. Perform HTTP HEAD requests instead of GETs. This
will retrieve headers only, and bytes reported wil be 0.
-c Perform a full connection on each request; ignore
keep-alive.
-r Follow HTTP redirects.
-w timeout Wait 'timeout' seconds for a response before timing out.
Specify 0 to avoid timing out.
If not specified, the default timeout is 30 seconds.
-p Use the proxy defined in the Windows Internet settings.
-d Print the date and time of each ping attempt.
-o data Perform HTTP POSTs sending the given data. Please enclose
the data in quotes if it contains spaces.
-of file-name Perform HTTP POSTs sending the contents of file
'file-name'. Please specify the full path, and use quotes
if the file name contains spaces.

Exit code: The percentage of requests that succeed.

Version: 5.0.0.33 (Dec 24 2011)

Examples: > http-ping http://www.yahoo.com
- Pings the yahoo home page 4 times.
> http-ping -t http://localhost:8080
- Repeatedly pings the web server at port 8080 on your
local machine until stopped.

---------------------------------------------------------------------------
This free utility is Copyright 2011, Core Technologies Consulting, LLC.
Find out about this and our other products at our web site:
http://www.CoreTechnologies.com/
---------------------------------------------------------------------------

-rでリダイレクト先のレスポンスを確認。

C:\tools\http-ping>

バッチとの連携
http://www.coretechnologies.com/products/AlwaysUp/alwaysup-sanity-check-web-server.bat
———————————————-

@echo off
REM This batch file is for use with AlwaysUp (http://www.coretechnologies.com/products/AlwaysUp/) or Service Protector (http://www.coretechnologies.com/products/ServiceProtector/)
REM Copyright � 2001-2012 Core Technologies Consulting, LLC. All rights reserved.

REM Ping your web server
REM *** Please change the location of http-ping.exe if necessary and adjust the URL to point to your web server ***
"C:\Program Files\AlwaysUp\http-ping.exe" http://localhost:80

REM http-ping returns the percentage of pings that succeed. With 4 attempts, this can be 0, 25, 50, 75, or 100.
REM Any of the 4 pings succeeds consider it a success ==> return 0 so that AlwaysUp doesn't restart
IF ERRORLEVEL 25 GOTO success
IF ERRORLEVEL 50 GOTO success
IF ERRORLEVEL 75 GOTO success
IF ERRORLEVEL 100 GOTO success

REM Exit code of 0 ==> all failed ==> return 1 to have AlwaysUp restart the application
IF ERRORLEVEL 0 GOTO failure

REM http-ping returned a code < 0 ==> there was some other kind of failure. Don't restart, but have AlwaysUp log the failure ==> return 2
echo http-ping failed!
exit 2

:success
echo Succeeded!
exit 0

:failure
echo Failed!
exit 1

———————————————-

その他のツールも以下のサイトでダウンロード出来ます。
Core Technologies Consulting, LLC


TOPコマンドでパフォーマンスを確認する事で問題ないのですが、
少しだけビジュアライズされてキーボードやマウスで簡単に操作出来るように
なっているHTOPでパフォーマンス確認をより身近にする事で気付ける事も
あるかもしれません。

ダウンロード

[root@colinux htop]# wget http://citylan.dl.sourceforge.net/project/htop/htop/0.8.3/htop-0.8.3.tar.gz
–2012-06-15 09:58:08– http://citylan.dl.sourceforge.net/project/htop/htop/0.8.3/htop-0.8.3.tar.gz
citylan.dl.sourceforge.net をDNSに問いあわせています… 212.118.44.106, 2a03:1800:1:7::2
citylan.dl.sourceforge.net|212.118.44.106|:80 に接続しています… 接続しました。
HTTP による接続要求を送信しました、応答を待っています… 200 OK
長さ: 428061 (418K) [application/x-gzip]
`htop-0.8.3.tar.gz’ に保存中

100%[====================================================================================>] 428,061 71.5K/s 時間 5.9s

2012-06-15 09:58:15 (71.5 KB/s) – `htop-0.8.3.tar.gz’ へ保存完了 [428061/428061]

[root@colinux htop]#

展開

[root@colinux htop]# tar xzvf htop-0.8.3.tar.gz
htop-0.8.3/
htop-0.8.3/Makefile.am
htop-0.8.3/ClockMeter.h
htop-0.8.3/depcomp
htop-0.8.3/Meter.c
htop-0.8.3/htop.1.in
htop-0.8.3/SignalItem.c
htop-0.8.3/plpa-1.1/
htop-0.8.3/plpa-1.1/Makefile.am
htop-0.8.3/plpa-1.1/src/
htop-0.8.3/plpa-1.1/src/Makefile.am
htop-0.8.3/plpa-1.1/src/plpa.h.in
htop-0.8.3/plpa-1.1/src/plpa_dispatch.c
[…省略]
htop-0.8.3/acinclude.m4
htop-0.8.3/Object.c
htop-0.8.3/htop.c
htop-0.8.3/autogen.sh
htop-0.8.3/AvailableMetersPanel.c
[root@colinux htop]#

インストール [configure -> make -> make install]

[root@colinux htop-0.8.3]# ./configure
checking for a BSD-compatible install… /usr/bin/install -c
checking whether build environment is sane… yes
checking for a thread-safe mkdir -p… /bin/mkdir -p
checking for gawk… gawk
checking whether make sets $(MAKE)… yes
checking for gcc… gcc
checking for C compiler default output file name… a.out
checking whether the C compiler works… yes
checking whether we are cross compiling… no
checking for suffix of executables…
checking for suffix of object files… o
checking whether we are using the GNU C compiler… yes
[…省略]
checking for unistd.h… (cached) yes
checking curses.h usability… no
checking curses.h presence… no
checking for curses.h… no
configure: error: missing headers: curses.h
[root@colinux htop-0.8.3]#

configureでエラーになったので必要なパッケージをインストール
エラー内容:configure: error: missing headers: curses.h

[root@colinux htop-0.8.3]# yum install ncurses-devel
fedora 100% |=========================| 2.1 kB 00:00
updates 100% |=========================| 2.3 kB 00:00
Setting up Install Process
Parsing package install arguments

今回は無事にconfigureが完了したので、
makeとmake installしてインストールを完了。

configure: creating ./config.status
config.status: creating plpa-1.1/Makefile
config.status: creating plpa-1.1/src/Makefile
config.status: creating Makefile
config.status: creating htop.1
config.status: creating config.h
config.status: config.h is unchanged
config.status: creating plpa-1.1/src/plpa_config.h
config.status: creating plpa-1.1/src/plpa.h
config.status: executing depfiles commands
[root@colinux htop-0.8.3]#
[root@colinux htop-0.8.3]# make
[…省略]
[root@colinux htop-0.8.3]# make install
[…省略]

htopを起動してみる。
パスを指定しなければ以下のパスにインストールされている。

[root@colinux htop-0.8.3]# whereis htop
htop: /usr/local/bin/htop
[root@colinux htop-0.8.3]#
[root@colinux htop-0.8.3]# htop

起動後はF1~F10キーでNICEやTREEなども操作出来る。

通常起動後

htop

htop


minttyをインストールしてみた。
Windows上でwget, vim, Linuxコマンドが簡単に利用出来て便利かもしれない。

Downloadサイト
http://sourceforge.net/projects/mingw/files/Installer/mingw-get-inst/

今回は以下のファイルを利用
http://sourceforge.net/projects/mingw/files/Installer/mingw-get-inst/mingw-get-inst-20120426/

1)DOWNLOADが終わったらセットアップを実行

2) Repository Catalogの選択

Compilerの選択

WEBにアクセスして必要なコンポーネントの自動ダウンロード

SETUP COMPLATED

WINDOWS PATH追加
C:\MinGW\msys\1.0\bin

パッケージのアップデートとMSYSのインストール
$ mingw-get update

$ mingw-get install msys-mintty

Mintty起動用ショートカットの作成とオプション設定
1. 「ショートカット」 C:\MinGW\msys\1.0\bin\mintty.exe /bin/bash –login -i
2. オプション設定

設定とアプリケーションインストール

$ mingw-get update

$ mingw-get upgrade

$ mingw-get install msys-coreutils msys-man msys-tar msys-gzip msys-wget msys-zip msys-unzip msys-vim
$ mingw-get install msys-openssl msys-openssh

インストール後の簡単な確認

パッケージリスト

anywhere@any-place ~/temp20120609
$ mingw-get list | egrep “Package:”
Package: mingw-developer-toolkit Subsystem: msys
Package: mingw32-autoconf Subsystem: mingw32
Package: mingw32-autoconf2.1 Subsystem: mingw32
Package: mingw32-autoconf2.5 Subsystem: mingw32
Package: mingw32-automake Subsystem: mingw32
Package: mingw32-automake1.10 Subsystem: mingw32
Package: mingw32-automake1.11 Subsystem: mingw32
Package: mingw32-automake1.4 Subsystem: mingw32
Package: mingw32-automake1.5 Subsystem: mingw32
Package: mingw32-automake1.6 Subsystem: mingw32
Package: mingw32-automake1.7 Subsystem: mingw32
Package: mingw32-automake1.8 Subsystem: mingw32
Package: mingw32-automake1.9 Subsystem: mingw32
Package: mingw32-autotools Subsystem: mingw32
Package: mingw32-base Subsystem: mingw32
Package: mingw32-basic-bsdtar Subsystem: mingw32
Package: mingw32-binutils Subsystem: mingw32
Package: mingw32-bsdcpio Subsystem: mingw32
Package: mingw32-bsdtar Subsystem: mingw32
Package: mingw32-bzip2 Subsystem: mingw32
Package: mingw32-dos2unix Subsystem: mingw32
Package: mingw32-expat Subsystem: mingw32
Package: mingw32-gcc Subsystem: mingw32
Package: mingw32-gcc-ada Subsystem: mingw32
Package: mingw32-gcc-fortran Subsystem: mingw32
Package: mingw32-gcc-g++ Subsystem: mingw32
Package: mingw32-gcc-objc Subsystem: mingw32
Package: mingw32-gcc-tools-epoch2-autoconf Subsystem: mingw32
Package: mingw32-gcc-tools-epoch2-automake Subsystem: mingw32
Package: mingw32-gcc-v3-ada Subsystem: mingw32
Package: mingw32-gcc-v3-core Subsystem: mingw32
Package: mingw32-gcc-v3-fortran Subsystem: mingw32
Package: mingw32-gcc-v3-g++ Subsystem: mingw32
Package: mingw32-gcc-v3-java Subsystem: mingw32
Package: mingw32-gcc-v3-objc Subsystem: mingw32
Package: mingw32-gdb Subsystem: mingw32
Package: mingw32-gdb-python Subsystem: mingw32
Package: mingw32-gendef Subsystem: mingw32
Package: mingw32-gettext Subsystem: mingw32
Package: mingw32-gmp Subsystem: mingw32
Package: mingw32-libarchive Subsystem: mingw32
Package: mingw32-libasprintf Subsystem: mingw32
Package: mingw32-libbz2 Subsystem: mingw32
Package: mingw32-libcharset Subsystem: mingw32
Package: mingw32-libexpat Subsystem: mingw32
Package: mingw32-libgcc Subsystem: mingw32
Package: mingw32-libgettextpo Subsystem: mingw32
Package: mingw32-libgfortran Subsystem: mingw32
Package: mingw32-libgmp Subsystem: mingw32
Package: mingw32-libgmpxx Subsystem: mingw32
Package: mingw32-libgnat Subsystem: mingw32
Package: mingw32-libgomp Subsystem: mingw32
Package: mingw32-libiconv Subsystem: mingw32
Package: mingw32-libintl Subsystem: mingw32
Package: mingw32-libltdl Subsystem: mingw32
Package: mingw32-liblzma Subsystem: mingw32
Package: mingw32-libminizip Subsystem: mingw32
Package: mingw32-libmpc Subsystem: mingw32
Package: mingw32-libmpfr Subsystem: mingw32
Package: mingw32-libobjc Subsystem: mingw32
Package: mingw32-libpdcurses Subsystem: mingw32
Package: mingw32-libpopt Subsystem: mingw32
Package: mingw32-libpthread-old Subsystem: mingw32
Package: mingw32-libpthreadgc Subsystem: mingw32
Package: mingw32-libpthreadgce Subsystem: mingw32
Package: mingw32-libquadmath Subsystem: mingw32
Package: mingw32-libquserex Subsystem: mingw32
Package: mingw32-libssp Subsystem: mingw32
Package: mingw32-libstdc++ Subsystem: mingw32
Package: mingw32-libtool Subsystem: mingw32
Package: mingw32-libunistring Subsystem: mingw32
Package: mingw32-libz Subsystem: mingw32
Package: mingw32-lua Subsystem: mingw32
Package: mingw32-make Subsystem: mingw32
Package: mingw32-mgwport Subsystem: mingw32
Package: mingw32-mingw-get Subsystem: mingw32
Package: mingw32-mingw-utils Subsystem: mingw32
Package: mingw32-mingwrt Subsystem: mingw32
Package: mingw32-minizip Subsystem: mingw32
Package: mingw32-mpc Subsystem: mingw32
Package: mingw32-mpfr Subsystem: mingw32
Package: mingw32-pdcurses Subsystem: mingw32
Package: mingw32-pexports Subsystem: mingw32
Package: mingw32-pkginfo Subsystem: mingw32
Package: mingw32-popt Subsystem: mingw32
Package: mingw32-pthreads-w32 Subsystem: mingw32
Package: mingw32-w32api Subsystem: mingw32
Package: mingw32-xz Subsystem: mingw32
Package: mingw32-zlib Subsystem: mingw32
Package: msys-autoconf Subsystem: msys
Package: msys-autogen Subsystem: msys
Package: msys-automake Subsystem: msys
Package: msys-base Subsystem: msys
Package: msys-bash Subsystem: msys
Package: msys-binutils Subsystem: msys
Package: msys-bison Subsystem: msys
Package: msys-bsdcpio Subsystem: msys
Package: msys-bsdtar Subsystem: msys
Package: msys-bzip2 Subsystem: msys
Package: msys-console Subsystem: msys
Package: msys-core Subsystem: msys
Package: msys-coreutils Subsystem: msys
Package: msys-crypt Subsystem: msys
Package: msys-cvs Subsystem: msys
Package: msys-cygutils Subsystem: msys
Package: msys-dash Subsystem: msys
Package: msys-diffstat Subsystem: msys
Package: msys-diffutils Subsystem: msys
Package: msys-dos2unix Subsystem: msys
Package: msys-expat Subsystem: msys
Package: msys-file Subsystem: msys
Package: msys-findutils Subsystem: msys
Package: msys-flex Subsystem: msys
Package: msys-gawk Subsystem: msys
Package: msys-gcc Subsystem: msys
Package: msys-gdbm Subsystem: msys
Package: msys-gettext Subsystem: msys
Package: msys-gmp Subsystem: msys
Package: msys-grep Subsystem: msys
Package: msys-groff Subsystem: msys
Package: msys-guile Subsystem: msys
Package: msys-gzip Subsystem: msys
Package: msys-help2man Subsystem: msys
Package: msys-inetutils Subsystem: msys
Package: msys-less Subsystem: msys
Package: msys-libarchive Subsystem: msys
Package: msys-libasprintf Subsystem: msys
Package: msys-libbz2 Subsystem: msys
Package: msys-libcharset Subsystem: msys
Package: msys-libcrypt Subsystem: msys
Package: msys-libexpat Subsystem: msys
Package: msys-libgdbm Subsystem: msys
Package: msys-libgettextpo Subsystem: msys
Package: msys-libgmp Subsystem: msys
Package: msys-libguile Subsystem: msys
Package: msys-libiconv Subsystem: msys
Package: msys-libintl Subsystem: msys
Package: msys-libltdl Subsystem: msys
Package: msys-liblzma Subsystem: msys
Package: msys-libmagic Subsystem: msys
Package: msys-libminires Subsystem: msys
Package: msys-libminizip Subsystem: msys
Package: msys-libopenssl Subsystem: msys
Package: msys-libopts Subsystem: msys
Package: msys-libpopt Subsystem: msys
Package: msys-libregex Subsystem: msys
Package: msys-libtermcap Subsystem: msys
Package: msys-libtool Subsystem: msys
Package: msys-libxml2 Subsystem: msys
Package: msys-lndir Subsystem: msys
Package: msys-locate Subsystem: msys
Package: msys-lpr-enhanced Subsystem: msys
Package: msys-m4 Subsystem: msys
Package: msys-make Subsystem: msys
Package: msys-man Subsystem: msys
Package: msys-minires Subsystem: msys
Package: msys-minizip Subsystem: msys
Package: msys-mintty Subsystem: msys
Package: msys-mksh Subsystem: msys
Package: msys-mktemp Subsystem: msys
Package: msys-openssh Subsystem: msys
Package: msys-openssl Subsystem: msys
Package: msys-patch Subsystem: msys
Package: msys-perl Subsystem: msys
Package: msys-popt Subsystem: msys
Package: msys-rebase Subsystem: msys
Package: msys-regex Subsystem: msys
Package: msys-rsync Subsystem: msys
Package: msys-rxvt Subsystem: msys
Package: msys-sed Subsystem: msys
Package: msys-system-builder Subsystem: msys
Package: msys-tar Subsystem: msys
Package: msys-termcap Subsystem: msys
Package: msys-texinfo Subsystem: msys
Package: msys-tiny Subsystem: msys
Package: msys-unzip Subsystem: msys
Package: msys-vim Subsystem: msys
Package: msys-w32api Subsystem: msys
Package: msys-wget Subsystem: msys
Package: msys-xz Subsystem: msys
Package: msys-zip Subsystem: msys
Package: msys-zlib Subsystem: msys

anywhere@any-place ~/temp20120609
$

mintty導入後の設定微調整とコンパイラー確認

1. Compile
2. 環境設定

1.Compileの基本確認
Cで動作確認用のソースを書いて、コンパイルの基本動作確認をしてみた。


#include <stdio.h>

main()
{
   int number;

   printf("Enter an integer\n");
   scanf("%d",&number);

   printf("Integer entered by you is %d\n", number);

   return 0;
}

コンパイルの動作確認

2. 環境設定
UTF-8とSJISが混在して日本語表示がおかしくなるので、ユーザー環境変数を変更。

—————————-
MEMO on July/1
—————————-
~/.profile

# lsで日本語を表示するためのalias
alias ls='ls --color=auto --show-control-chars'
# gettext用
export OUTPUT_CHARSET=sjis

~/.inputrc

set meta-flag on
set output-meta on
set convert-meta off
set kanji-code sjis

~/.minttyrc
Locale=ja_JP
Charset=SJIS

/share/misc/man.conf

# manは標準ではsjisで出力できないためutf8で出力する
JNROFF /usr/bin/groff -DeucJP -Tutf8 -mandoc
JNEQN /usr/bin/eqn -Tutf8

# PAGERでsjisへ変換
PAGER nkf -s | /usr/bin/less -isrR

~/.vimrc

set enc=sjis

参考:
mintty
Windowsで最高のターミナルを構築する方法
List of terminal emulators


nuttcpでネットワークの状態を簡易的に調査・検証する事が出来ます。
—————————————————————-
nuttcp is a TCP/UDP network testing tool, much like iperf.
I think it’s the best such tool available, for its simplicity, ease of use, and feature set.

http://www.lcp.nrl.navy.mil/nuttcp/
対象ドメイン navy.mil (mil:IANAトップドメイン情報)
組織・国・地域 military 米軍事機関用


Phil Dykstra’s nuttcp quick start guide

今回の検証は、最新のSTABLEバージョンで行いましたが、
6.2.7以降では再送処理も取得出来るそうです。
—————————————————————-
TCP retransmit info (Linux only)
Starting in version 6.2.7, nuttcp includes retransmit info for Linux.
This is much more convenient that using tcpdump to determine if the path has lots of congestion.

サーバー側
http://lcp.nrl.navy.mil/nuttcp/stable/rpm/nuttcp-5.3.1-1.i386.rpm
検証ではLinuxにてサーバーを実行

[root@colinux ~]# wget http://www.lcp.nrl.navy.mil/nuttcp/stable/rpm/nuttcp-5.3.1-1.i386.rpm
--2012-06-03 07:53:20--  http://www.lcp.nrl.navy.mil/nuttcp/stable/rpm/nuttcp-5.3.1-1.i386.rpm
www.lcp.nrl.navy.mil をDNSに問いあわせています... 132.250.114.61
www.lcp.nrl.navy.mil|132.250.114.61|:80 に接続しています... 接続しました。
HTTP による接続要求を送信しました、応答を待っています... 200 OK
長さ: 52369 (51K) [application/x-rpm]
`nuttcp-5.3.1-1.i386.rpm' に保存中
100%[==========================================================================>] 52,369      82.5K/s 時間 0.6
2012-06-03 07:53:21 (82.5 KB/s) - `nuttcp-5.3.1-1.i386.rpm' へ保存完了 [52369/52369]
[root@colinux ~]# ls -l


[root@colinux ~]# rpm -ivh nuttcp-5.3.1-1.i386.rpm
準備中...                   ########################################### [100%]
   1:nuttcp                 ########################################### [100%]
[root@colinux ~]#


[root@colinux ~]# nuttcp -S
[root@colinux ~]# ps -ef | grep nuttcp
root      2882     1  0 08:01 pts/0    00:00:00 nuttcp -S
root      2884  2837  1 08:01 pts/0    00:00:00 grep nuttcp
[root@colinux ~]#

クライアント側
http://lcp.nrl.navy.mil/nuttcp/stable/bin/nuttcp-5.3.1.win32.zip
検証ではWindowsにてクライアントを実行

Colinuxで検証したので、以下のPortへのアクセス許可を設定してあります。
port number to send to|listen at (default 5001)
port number for control connection (default 5000)

nuttcp client

Help内容(オプション)
—————————————————————-
Usage: nuttcp or nuttcp -h prints this usage info
Usage: nuttcp -V prints version info
Usage: nuttcp -xt [-m] host forward and reverse traceroute to/from server
Usage (transmitter): nuttcp [-t] [-options] host [3rd-party] [ out ]
-4 Use IPv4
-6 Use IPv6
-c## cos dscp value on data streams (t|T suffix for full TOS field)
-l## length of network write|read buf (default 1K|8K/udp, 64K/tcp)
-s use stdin|stdout for data input|output instead of pattern data
-n## number of source bufs written to network (default unlimited)
-w## transmitter|receiver window size in KB (or (m|M)B or (g|G)B)
-ws## server receive|transmit window size in KB (or (m|M)B or (g|G)B)
-wb braindead Solaris 2.8 (sets both xmit and rcv windows)
-p## port number to send to|listen at (default 5001)
-P## port number for control connection (default 5000)
-u use UDP instead of TCP
-m## use multicast with specified TTL instead of unicast (UDP)
-M## MSS for data connection (TCP)
-N## number of streams (starting at port number), implies -B
-R## transmit rate limit in Kbps (or (m|M)bps or (g|G)bps or (p)ps)
-T## transmit timeout in seconds (or (m|M)inutes or (h|H)ours)
-i## receiver interval reporting in seconds (or (m|M)inutes)
-Ixxx identifier for nuttcp output (max of 40 characters)
-F flip option to reverse direction of data connection open
-d set TCP SO_DEBUG option on data socket
-v[v] verbose [or very verbose] output
-b brief output (default)
-D xmit only: don’t buffer TCP writes (sets TCP_NODELAY sockopt)
-B recv only: only output full blocks of size from -l## (for TAR)
Usage (server): nuttcp -S[f][P] [-options]
note server mode excludes use of -s
‘f’ suboption forces server mode (useful with rsh/ssh)
‘P’ suboption makes 3rd party {in,out}bound control ports same
-4 Use IPv4 (default)
-6 Use IPv6
-1 oneshot server mode (implied with inetd/xinetd), implies -S
-P## port number for server connection (default 5000)
note don’t use with inetd/xinetd (use services file instead)
–no3rdparty don’t allow 3rd party capability
–nofork don’t fork server
Format options:
-fxmitstats also give transmitter stats (MB) with -i (UDP only)
-frunningtotal also give cumulative stats on interval reports
-f-drops don’t give packet drop info on brief output (UDP)
-f-percentloss don’t give %loss info on brief output (UDP)
-fparse generate key=value parsable output

Bufferサイズを変更してネットワーク診断

C:\Tools\tmp\nuttcp>nuttcp-5.3.1.exe -v -v -i1 192.168.11.10
nuttcp-t: v5.3.1: socket
nuttcp-t: buflen=65536, nstream=1, port=5001 tcp -> 192.168.11.10
nuttcp-t: time limit = 10.00 seconds
nuttcp-t: connect to 192.168.11.10 with mss=0
nuttcp-t: send window size = 8192, receive window size = 8192
nuttcp-r: v5.3.1: socket
nuttcp-r: buflen=65536, nstream=1, port=5001 tcp
nuttcp-r: interval reporting every 1.00 second
nuttcp-r: accept from 192.168.11.2
nuttcp-r: send window size = 8192, receive window size = 8192
    1.0000 MB /   1.00 sec =    8.3886 Mbps
    1.3125 MB /   1.00 sec =   11.0100 Mbps
    0.8125 MB /   1.00 sec =    6.8157 Mbps
    1.1250 MB /   1.00 sec =    9.4372 Mbps
    2.1250 MB /   1.00 sec =   17.8258 Mbps
    1.3750 MB /   1.00 sec =   11.5343 Mbps
    0.7500 MB /   1.00 sec =    6.2915 Mbps
    1.2500 MB /   1.00 sec =   10.4858 Mbps
    0.8750 MB /   1.00 sec =    7.3400 Mbps
    1.1250 MB /   1.00 sec =    9.4372 Mbps
nuttcp-t: 11.7500 MB in 10.00 real seconds = 1203.20 KB/sec = 9.8566 Mbps
nuttcp-t: 188 I/O calls, msec/call = 54.47, calls/sec = 18.80
nuttcp-t: 0.0user 0.0sys 0:10real 0% 0i+0d 1806maxrss 20+0pf 0+0csw

nuttcp-r: 11.7500 MB in 10.12 real seconds = 1188.35 KB/sec = 9.7349 Mbps
nuttcp-r: 2711 I/O calls, msec/call = 3.82, calls/sec = 267.75
nuttcp-r: 0.0user 0.0sys 0:10real 0% 0i+0d 1690maxrss 0+0pf 0+0csw

---------------------------------------------------------------
http://www.wcisd.hpc.mil/nuttcp/Nuttcp-HOWTO.html
  -i1       to watch tests run (1 second intervals)
  -w8m      to set socket buffers ("window") to 8 MBytes
  -u        for UDP tests
  -R10m     for a 10 Mbps UDP test (or TCP rate limit)
  -l512     to set UDP packet length (or TCP write size)
---------------------------------------------------------------


C:\Tools\tmp\nuttcp>nuttcp-5.3.1.exe -w8m -v -v -i1 192.168.11.10
nuttcp-t: v5.3.1: socket
nuttcp-t: buflen=65536, nstream=1, port=5001 tcp -> 192.168.11.10
nuttcp-t: time limit = 10.00 seconds
nuttcp-t: connect to 192.168.11.10 with mss=0
nuttcp-t: send window size = 8388608, receive window size = 8192
nuttcp-r: v5.3.1: socket
nuttcp-r: buflen=65536, nstream=1, port=5001 tcp
nuttcp-r: interval reporting every 1.00 second
nuttcp-r: accept from 192.168.11.2
nuttcp-r: send window size = 8192, receive window size = 8388608
   14.9651 MB /   1.00 sec =  125.5366 Mbps
   17.3642 MB /   1.00 sec =  145.6613 Mbps
   37.0160 MB /   1.42 sec =  218.3634 Mbps
   21.7070 MB /   0.59 sec =  306.5508 Mbps
   23.5170 MB /   1.00 sec =  197.2752 Mbps
nuttcp-t: 119.5625 MB in 10.00 real seconds = 12243.20 KB/sec = 100.2963 Mbps
nuttcp-t: 1913 I/O calls, msec/call = 5.35, calls/sec = 191.30
nuttcp-t: 0.0user 0.1sys 0:10real 2% 0i+0d 1806maxrss 20+0pf 0+0csw

nuttcp-r: 119.5625 MB in 5.88 real seconds = 20839.49 KB/sec = 170.7171 Mbps
nuttcp-r: 17961 I/O calls, msec/call = 0.33, calls/sec = 3057.19
nuttcp-r: 0.3user 1.3sys 0:05real 27% 0i+0d 1690maxrss 0+0pf 0+0csw

C:\Tools\tmp\nuttcp>


Beta版を利用してのretransmissionの確認
動作確認なので、同じホストで検証しています。

[root@colinux ~]# wget http://www.lcp.nrl.navy.mil/nuttcp/beta/nuttcp-7.1.6.c
--2012-06-03 09:09:54--  http://www.lcp.nrl.navy.mil/nuttcp/beta/nuttcp-7.1.6.c
www.lcp.nrl.navy.mil をDNSに問いあわせています... 132.250.114.61
www.lcp.nrl.navy.mil|132.250.114.61|:80 に接続しています... 接続しました。
HTTP による接続要求を送信しました、応答を待っています... 200 OK
長さ: 251878 (246K) 
`nuttcp-7.1.6.c' に保存中

100%[=========================================================================================>] 251,878      113K/s 時間 2.2s

2012-06-03 09:09:57 (113 KB/s) - `nuttcp-7.1.6.c' へ保存完了 [251878/251878]

[root@colinux ~]# 

[root@colinux nuttcp]# cc -O3 -o nuttcp nuttcp-7.1.6.c
[root@colinux nuttcp]# 
[root@colinux nuttcp]# ls -l
合計 392
-rwxr-xr-x 1 root root 138267 2012-06-03 09:11 nuttcp
-rw-r--r-- 1 root root 251878 2012-03-01 06:29 nuttcp-7.1.6.c
[root@colinux nuttcp]# ./nuttcp -S
[root@colinux nuttcp]# ./nuttcp -i1 localhost
   82.7500 MB /   1.00 sec =  694.1462 Mbps     0 retrans
   93.9375 MB /   1.00 sec =  787.9930 Mbps     0 retrans
   94.5625 MB /   1.00 sec =  793.2358 Mbps     0 retrans
   94.8125 MB /   1.00 sec =  795.3330 Mbps     0 retrans
   94.3125 MB /   1.00 sec =  791.1387 Mbps     0 retrans
   94.5625 MB /   1.00 sec =  793.2358 Mbps     0 retrans
   94.4375 MB /   1.00 sec =  792.1873 Mbps     0 retrans
   93.9375 MB /   1.00 sec =  787.9930 Mbps     0 retrans
   93.7500 MB /   1.00 sec =  786.4202 Mbps     0 retrans
   90.7500 MB /   1.00 sec =  761.2548 Mbps     0 retrans

  928.9531 MB /  10.01 sec =  778.4721 Mbps 82 %TX 18 %RX 0 retrans
[root@colinux nuttcp]#

nuttcp compile

nuttcp retrunsmit

nuttcp retrunsmit

retrunsmit

参考:
http://wcisd.hpc.mil/nuttcp/Nuttcp-HOWTO.html
http://fasterdata.es.net/performance-testing/network-troubleshooting-tools/nuttcp/
http://sourceforge.jp/magazine/08/08/22/0159234
http://hylom.net/2011/05/18/nuttcp_thruput_benchmarking/


Etherrealは昔からネットワーク解析ツールとして、
Linuxで長期に利用されてきたツールでしたが、
理由があって名前をWiresharkにして存続しているようです。

Wireshark

ネットワークを介して通信するパケットを収集し、
その内容や送信先などを解析することができます。

Wiresharkプロジェクト
http://sourceforge.jp/projects/wireshark/
Download Page
http://sourceforge.jp/projects/wireshark/releases/ (1.4.13)
http://www.wireshark.org/download.html (1.6.8)

1) ダウンロード

Wireshark Install_1

2) SET UP

Wireshark Install_2

3) INSTALL OPTION

Wireshark Install_3

4) INSTALL PATH

Wireshark Install_4

5) INTALL WINPCAP

Wireshark Install_5

6) INSTALL WINPCAP License Info

Wireshark Install_6

7) WINPCAP BOOT OPTION

Wireshark Install_7

8) WINPCAP END OF INSTALL

Wireshark Install_8

9) WIRESHARK INSTALLATION FINISHED

Wireshark Install_9

10) WIRESHARK起動

Wireshark Install_9

11) PACKET CAPTURE TEST
ACCESS TO YAHOO

Wireshark Install_10

11) PACKET CAPTURE RESULT

Wireshark Install_11

12) PACKET CAPTURE RESULT AND FILTER

Wireshark Install_12

その他、フィルター項目に関しては色々と選択出来ます。
また、特定のアクセスフローのみを追う事も可能です。

参考:
ネットワークのトラブル解析などに利用できるネットワークアナライザー「Wireshark」の使い方
RPCAPによるリモートパケットモニター