wgetを使ってWebサイトのヘルスチェック

投稿日: 2014/04/16 13:57:40

(1) 自分自身にsshして以下のようにコマンドを登録

ping -c 3 sites.google.com

wget -SO /dev/null https://sites.google.com/site/kanta01web/autocommander,find,HTTP/1.1 200 OK => HTTP/1.1 200 OKという文字列をチェック

(2) 出力されるレポート

Command : wget -SO /dev/null https://sites.google.com/site/kanta01web/autocommander

[Time] 2014-04-16-22-49-15-106

[Top] [Prev] [Next]

[MyPC]$ wget -SO /dev/null https://sites.google.com/site/kanta01web/autocommander

--2014-04-16 22:49:15-- https://sites.google.com/site/kanta01web/autocommander Resolving sites.google.com... 173.194.38.70, 173.194.38.72, 173.194.38.73, ... Connecting to sites.google.com|173.194.38.70|:443... connected. HTTP request sent, awaiting response... HTTP/1.1 200 OK Content-Type: text/html; charset=utf-8 X-Robots-Tag: noarchive Last-Modified: Tue, 08 Apr 2014 05:42:16 GMT ETag: "1396935736000|#public|0|en|||0" Expires: Wed, 16 Apr 2014 13:49:21 GMT Date: Wed, 16 Apr 2014 13:49:16 GMT Cache-Control: public, max-age=5 X-Content-Type-Options: nosniff X-XSS-Protection: 1; mode=block Server: GSE Alternate-Protocol: 443:quic Transfer-Encoding: chunked Length: unspecified [text/html] Saving to: ‘/dev/null’ [<=> ] 0 --.-K/s [ <=> ] 34,801 --.-K/s in 0.04s 2014-04-16 22:49:16 (785 KB/s) - ‘/dev/null’ saved [34801] [MyPC ~]$

[チェックする文字列] HTTP/1.1 200 OK [結果] PASS 存在 [応答] HTTP/1.1 200 OK [合計]: 1

(注)

PCの都合によりMac上で動作するようAutoCommanderを一部変更してMacで動作させた結果なので、

pingのオプションやwgetコマンドのオプション使用法はWindows晩wgetと異なります