2011年8月23日火曜日

telnetでSMTPを確認

トランザクションはこんな感じ。
# telnet 172.16.113.12 25
Trying 172.16.113.12...
Connected to 172.16.113.12 (172.30.113.12).
Escape character is '^]'.
220 localhost.localdomain ESMTP Sendmail 8.13.8/8.13.8; Tue, 23 Aug 2011 10:54:14 +0900
EHLO localhost
250-localhost.localdomain Hello [172.16.113.8], pleased to meet you
250-ENHANCEDSTATUSCODES
250-PIPELINING
250-8BITMIME
250-SIZE
250-DSN
250-ETRN
250-AUTH DIGEST-MD5 CRAM-MD5
250-DELIVERBY
250 HELP
MAIL FROM: canada@dev
250 2.1.0 canada@dev... Sender ok
RCPT TO: test@sys.jp
250 2.1.5 test@sys.jp... Recipient ok
DATA
354 Enter mail, end with "." on a line by itself
TEST
.
250 2.0.0 p7N1sEpb009113 Message accepted for delivery
QUIT
221 2.0.0 localhost.localdomain closing connection
Connection closed by foreign host.
 telnetでport25を指定して接続、EHLOコマンドでセッションを確立して、MAIL FROMとRCPT TOで送信元と宛先を指定、DATAコマンドで本文を書く。.(ドット)で本文終了。QUITでセッション切断。

2011年8月22日月曜日

kill でプロセスが落とせないときは

SIGHUP以外のシグナルをおくる。
たとえばSIGQUITとか。

kill -s 3 <PID>

以下がシグナルのリスト。

 1) SIGHUP       2) SIGINT       3) SIGQUIT      4) SIGILL
 5) SIGTRAP      6) SIGABRT      7) SIGBUS       8) SIGFPE
 9) SIGKILL     10) SIGUSR1     11) SIGSEGV     12) SIGUSR2
13) SIGPIPE     14) SIGALRM     15) SIGTERM     16) SIGSTKFLT
17) SIGCHLD     18) SIGCONT     19) SIGSTOP     20) SIGTSTP
21) SIGTTIN     22) SIGTTOU     23) SIGURG      24) SIGXCPU
25) SIGXFSZ     26) SIGVTALRM   27) SIGPROF     28) SIGWINCH
29) SIGIO       30) SIGPWR      31) SIGSYS      34) SIGRTMIN
35) SIGRTMIN+1  36) SIGRTMIN+2  37) SIGRTMIN+3  38) SIGRTMIN+4
39) SIGRTMIN+5  40) SIGRTMIN+6  41) SIGRTMIN+7  42) SIGRTMIN+8
43) SIGRTMIN+9  44) SIGRTMIN+10 45) SIGRTMIN+11 46) SIGRTMIN+12
47) SIGRTMIN+13 48) SIGRTMIN+14 49) SIGRTMIN+15 50) SIGRTMAX-14
51) SIGRTMAX-13 52) SIGRTMAX-12 53) SIGRTMAX-11 54) SIGRTMAX-10
55) SIGRTMAX-9  56) SIGRTMAX-8  57) SIGRTMAX-7  58) SIGRTMAX-6
59) SIGRTMAX-5  60) SIGRTMAX-4  61) SIGRTMAX-3  62) SIGRTMAX-2
63) SIGRTMAX-1  64) SIGRTMAX


2011年8月19日金曜日

BIG-IPのiRule使い方とか

BIG-IPのiRuleが結構便利。

設定は、[Local Traffic]->[iRules]からできる。

構文はこんな感じ。

when CLIENT_ACCEPTED  {
        if { [matchclass [IP::client_addr] equals $::proxy_global] }{
            pool POOL_TEST_80
        } else {
            reject
        }

}

when <EVENT>で、イベントを対象にして処理をトリガする。
CLIENT_ACCEPTEDだと、クライアントを受け付けたイベント。
ほかにもHTTP_REQUESTとかいろいろある。

2011年8月8日月曜日

linuxでCPUのベンチマーク

ちょっとlinuxでCPUのベンチをとる必要にかられたのでメモ。

使ったのはUnixBenchというツール。
ここからダウンロードできるみたい。

ダウンロードしたら、
tar zxvf UnixBench5.1.3.tgz
とかで普通に解凍して、makeを実行。あとは
./Run
で動かして、 結果が出力されるまでひたすら待つ。マルチCPUだと30分くらいかな?
環境によってはperlのTimes::HiResモジュールが必要なので、cpanでインストールする。

結果はこんな感じ

========================================================================
   BYTE UNIX Benchmarks (Version 5.1.3)

   System: myhostname: GNU/Linux
   OS: GNU/Linux -- 2.6.18-238.9.1.el5 -- #1 SMP Tue Apr 12 18:10:13 EDT 2011
   Machine: x86_64 (x86_64)
   Language: en_US.utf8 (charmap="UTF-8", collate="UTF-8")
   CPU 0: Intel(R) Xeon(R) CPU X5670 @ 2.93GHz (5866.9 bogomips)
          x86-64, MMX, Physical Address Ext, SYSENTER/SYSEXIT, SYSCALL/SYSRET
   00:24:56 up 2 days, 10:42,  2 users,  load average: 0.00, 0.00, 0.00; runlevel 3

------------------------------------------------------------------------
Benchmark Run: 月  8月 08 2011 00:24:56 - 00:53:06
1 CPU in system; running 1 parallel copy of tests

Dhrystone 2 using register variables       18388869.4 lps   (10.0 s, 7 samples)
Double-Precision Whetstone                     3613.3 MWIPS (9.9 s, 7 samples)
Execl Throughput                               6182.9 lps   (30.0 s, 2 samples)
File Copy 1024 bufsize 2000 maxblocks       1229990.6 KBps  (30.0 s, 2 samples)
File Copy 256 bufsize 500 maxblocks          353667.4 KBps  (30.0 s, 2 samples)
File Copy 4096 bufsize 8000 maxblocks       2294764.6 KBps  (30.0 s, 2 samples)
Pipe Throughput                             2850110.8 lps   (10.0 s, 7 samples)
Pipe-based Context Switching                 592138.4 lps   (10.0 s, 7 samples)
Process Creation                              19417.2 lps   (30.0 s, 2 samples)
Shell Scripts (1 concurrent)                   8989.3 lpm   (60.0 s, 2 samples)
Shell Scripts (8 concurrent)                   1257.5 lpm   (60.0 s, 2 samples)
System Call Overhead                        4903017.2 lps   (10.0 s, 7 samples)

System Benchmarks Index Values               BASELINE       RESULT    INDEX
Dhrystone 2 using register variables         116700.0   18388869.4   1575.7
Double-Precision Whetstone                       55.0       3613.3    657.0
Execl Throughput                                 43.0       6182.9   1437.9
File Copy 1024 bufsize 2000 maxblocks          3960.0    1229990.6   3106.0
File Copy 256 bufsize 500 maxblocks            1655.0     353667.4   2137.0
File Copy 4096 bufsize 8000 maxblocks          5800.0    2294764.6   3956.5
Pipe Throughput                               12440.0    2850110.8   2291.1
Pipe-based Context Switching                   4000.0     592138.4   1480.3
Process Creation                                126.0      19417.2   1541.0
Shell Scripts (1 concurrent)                     42.4       8989.3   2120.1
Shell Scripts (8 concurrent)                      6.0       1257.5   2095.9
System Call Overhead                          15000.0    4903017.2   3268.7
                                                                   ========
System Benchmarks Index Score                                        1947.0


とりあえず最後のIndexスコアっていうのが、全体の平均なので、その辺を参考に。 ちなみに上の結果は、Xeon5670の2.93GHzです。