2014年2月8日土曜日

ESXi上の仮想マシン起動時にBIOS画面を表示

仮想マシンであっても起動順序の調整等でBIOS画面をいじりたくなる場合が多々、いえ、時々あります。忘れがちなので設定方法のメモを残しておきます。



■仮想マシン起動時にBIOS画面表示
対象の仮想マシンを右クリックして「設定の編集」画面を表示
オプションタブ > 強制的にBIOSセットアップ > 次回仮想マシンの起動時に・・・にチェック

※このチェックは1度きりで外れます。次々回はBIOS画面ではなく普通にOSが起動します。

仮想マシンを起動するとコンソールにBIOS画面が表示されます。


以上です。こちら情報が何かのお役にたてれば幸いです。m(_ _)m

2014年2月7日金曜日

VMware ESXiに直接SSHでログインする方法

以前はサーバルームの鍵を借りて、物理サーバの前まで行って、キーボードとディスプレイをつないで、"unsupported"コマンドなるものを打っていましたが、ESXi 5系からはvSphere ClientでSSHを有効化できるようになったので今さらですがメモを残しておきます。



■vSphere Clientの設定
構成 > ソフトウェア > セキュリティプロファイル > サービス > プロパティ


SSH(停止)を選択してオプションボタン


開始 > OKボタン


SSHが実行中になったことを確認して、OKボタン

以上で設定完了です。


■SSHでログインしてみる
putty等でLinux VMに接続するのと同じようにESXiサーバのIPを指定してSSHログイン。
Using username "root".
Server refused our key
Using keyboard-interactive authentication.
Password:
The time and date of this login have been sent to the system logs.

VMware offers supported, powerful system administration tools.  Please
see www.vmware.com/go/sysadmintools for details.

The ESXi Shell can be disabled by an administrative user. See the
vSphere Security documentation for more information.
~ # pwd
/
~ # ls -l
lrwxrwxrwx   1 root   root       49 Feb 10 13:31 altbootbank -> /vmfs/volumes/56a9157c-ead5c024-c408-3aff00d6f9ce
drwxr-xr-x   1 root   root      512 Feb 10 13:30 bin
lrwxrwxrwx   1 root   root       49 Feb 10 13:31 bootbank -> /vmfs/volumes/6f9e437d-5e7ca139-8701-cb7a8ae27e15
drwxr-xr-x   1 root   root      512 Feb 10 13:52 dev
drwxr-xr-x   1 root   root      512 Feb 10 13:49 etc
drwxr-xr-x   1 root   root      512 Feb 10 13:30 lib
drwxr-xr-x   1 root   root      512 Feb 10 13:30 lib32
drwxr-xr-x   1 root   root      512 Feb 10 13:30 lib64
-r-x------   1 root   root    13884 Apr 30 21:16 local.tgz
lrwxrwxrwx   1 root   root        6 Feb 10 13:31 locker -> /store
drwxr-xr-x   1 root   root      512 Feb 10 13:30 opt
drwxr-xr-x   1 root   root   131072 Feb 10 13:52 proc
lrwxrwxrwx   1 root   root       23 Feb 10 13:31 productLocker -> /locker/packages/5.0.0/
drwxr-xr-x   1 root   root      512 Feb 10 13:30 sbin
lrwxrwxrwx   1 root   root       49 Feb 10 13:31 scratch -> /vmfs/volumes/4fa9b24f-cd223c10-7347-3c4a927216ed
lrwxrwxrwx   1 root   root       49 Feb 10 13:31 store -> /vmfs/volumes/2dc678ef-40e5d96b-90bf-855aab9c5547
drwxr-xr-x   1 root   root      512 Feb 10 13:30 tardisks
drwxrwxrwt   1 root   root      512 Feb 10 13:43 tmp
drwxr-xr-x   1 root   root      512 Feb 10 13:30 usr
drwxr-xr-x   1 root   root      512 Feb 10 13:31 var
drwxr-xr-x   1 root   root      512 Feb 10 13:30 vmfs
drwxr-xr-x   1 root   root      512 Feb 10 13:30 vmimages
lrwxrwxrwx   1 root   root       18 Feb 17  2012 vmupgrade -> /locker/vmupgrade/


こちら情報が何かのお役にたてれば幸いです。m(_ _)m

2014年1月31日金曜日

0秒リフレッシュで新規ウィンドウを開く方法

<meta>タグを使用することで、指定した秒数後に自動的に特定のページへ移動させることができますが、
target属性を指定できないので、同一ページで移動することしかできません。
そのページを残し、自動的に新規ウィンドウを開く場合はJavascriptを利用する方法があります。

■0秒後に別ページを同一ウィンドウに表示

<!DOCTYPE HTML>
 <html lang="ja">
 <head>
 <title>0秒遷移のサンプル(同一ウィンドウ)</title>
 <meta http-equiv="refresh" content="0;URL=http://www.yahoo.co.jp/">
 </head>
 <body>

 <p>0秒後にYahoo!Japanのトップページへ移動します。<br>
 自動的に移動しない場合は、以下のリンクをクリックして下さい。</p>

 <p><a href="http://www.yahoo.co.jp/">http://www.yahoo.co.jp/</a></p>

 </body>
 </html>

■0秒後に別ページを新規ウィンドウで表示

<!DOCTYPE HTML>
 <html lang="ja">
 <head>
 <meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
 <title>0秒遷移のサンプル(新規ウィンドウ)</title>
 <meta http-equiv="Content-Script-Type" content="text/javascript">
 <script type="text/javascript">
 <!-- 
function refresh_jump(){
 window.open("http://www.yahoo.co.jp/","newwindow");
 }
 //-->
 </script>
 </head>
 <body onload="setTimeout('refresh_jump()',0);">

 <p>0秒後にYahoo!Japanのトップページを新規ウィンドウで開きます。<br>
 自動的に開かない場合は、以下のリンクをクリックして下さい。</p>

 <p><a href="http://www.yahoo.co.jp/" target="_blank">http://www.yahoo.co.jp/</a></p>

 </body>
 </html>
※setTimeoutの値はミリ秒です。5秒後に自動移動させたい場合は5000と記述してください。

この情報が何かのお役にたてれば幸いです。m(_ _)m

2014年1月25日土曜日

認証付きproxy経由でyumとwgetを行う方法

社内ネットワークからインターネットへ接続する場合、認証付proxyを経由しなければならないケースが
多々あります。ブラウザの場合はproxyサーバをインターネットオプションに設定し、ID/Passwordを
入力すれば問題ありませんが、yumやwgetを利用する場合は、デフォルトだと入力するタイミングが
ないためブロックされてしまいます。これを回避する方法をまとめます。

OS: CentOS 6.5 (64-bit)
ProxyServer Hostname: proxy.tanyao.com
ProxyServer Prot: 8080
認証付きproxyのID(仮): ty201401
認証付きproxyのPassword(仮): secret


■yumの認証付きproxy対応設定

/etc/yum.confの最下行に下記を追記。
[root@cent65 ~]# tail -2 /etc/yum.conf
# Add Proxy
proxy=http://ty201401:secret@proxy.tanyao.com:8080/
proxy=http://[ID]:[Password]@[ProxyServer Hostname]:[Port]/
これで通常通りyumコマンドの操作が可能です。


■wgetの認証付きproxy対応設定

/etc/wgetrcを編集する方法もありますが、ここでは環境変数に設定する方法を紹介します。
[root@cent65 ~]# export http_proxy="http://ty201401:secret@proxy.tanyao.com:8080"
export http_proxy="http://[ID]:[Password]@[ProxyServer Hostname]:[Port]"
これで通常通りwgetコマンドの操作が可能です。


こちらの情報が何かのお役に立てましたら幸いです。サイト継続ご協力のほどお願い致します。m(_ _)m

2013年12月14日土曜日

wgetでWebサイトのレスポンスを調査するシェルスクリプト

wgetを利用して複数Webサイトのレスポンスを調査するシェルスクリプトのサンプルです。
今回は試しにキャリア3社のWebサイトのレスポンスを調査してみました。

OS: CentOS 6.4(64-bit)
wget: GNU Wget 1.12 built on linux-gnu.


■シェルスクリプトサンプル
[root@centos64 ~]# cat response.sh
#!/bin/sh
# wgetを利用してWebサイトのレスポンスを調査する。

URL=url.list
LOG=response_`date +%Y%m%d-%H%M`.log
TODAY=`date +%Y-%m-%d`

# url.listの存在チェック
if [ ! -f ${URL} ]; then
    echo "${URL} no such file or directory"
    exit 1
fi

wget -t 2 -P response -o ${LOG} -i ${URL}
rm -rf response

#grep "[0-9]\]$" ${LOG}
#grep -B 3 "404 Not Found" ${LOG}
grep ${TODAY} ${LOG}

exit 0
[root@centos64 ~]#
リトライは2回くらいで十分かと。

■URLリスト
[root@centos64 ~]# cat url.list
https://www.nttdocomo.co.jp/
https://www.nttdocomo.co.jp/product/
https://www.nttdocomo.co.jp/service/
https://www.nttdocomo.co.jp/binary/pdf/corporate/technology/document/pdc/jidoushadenwa.pdf

http://www.kddi.com/
http://www.au.kddi.com/
http://www.kddi.com/corporate/ir/library/annual_report/pdf/kddi_ar2013_j.pdf

http://www.softbank.jp/
http://www.softbank.jp/corp/
http://cdn.softbank.jp/corp/set/data/csr/pdf/csr2013_01.pdf
[root@centos64 ~]#
サイズの大きいPDFファイルへのリンク等を適当に入れています。

■実行結果
[root@centos64 ~]# ./response.sh
--2013-12-14 16:43:37--  https://www.nttdocomo.co.jp/
2013-12-14 16:43:42 (2.11 MB/s) - `response/index.html' へ保存終了 [44553]
--2013-12-14 16:43:42--  https://www.nttdocomo.co.jp/product/
2013-12-14 16:43:42 (2.02 MB/s) - `response/index.html.1' へ保存終了 [76905]
--2013-12-14 16:43:42--  https://www.nttdocomo.co.jp/service/
2013-12-14 16:43:43 (1.03 MB/s) - `response/index.html.2' へ保存終了 [162300]
--2013-12-14 16:43:43--  https://www.nttdocomo.co.jp/binary/pdf/corporate/technology/document/pdc/jidoushadenwa.pdf
2013-12-14 16:43:43 (2.18 MB/s) - `response/jidoushadenwa.pdf' へ保存完了 [733433/733433]
--2013-12-14 16:43:43--  http://www.kddi.com/
2013-12-14 16:43:48 (1023 KB/s) - `response/index.html.3' へ保存終了 [13808]
--2013-12-14 16:43:48--  http://www.au.kddi.com/
2013-12-14 16:43:53 (2.05 MB/s) - `response/index.html.4' へ保存完了 [56991/56991]
--2013-12-14 16:43:53--  http://www.kddi.com/corporate/ir/library/annual_report/pdf/kddi_ar2013_j.pdf
2013-12-14 16:43:55 (4.69 MB/s) - `response/kddi_ar2013_j.pdf' へ保存完了 [8913281/8913281]
--2013-12-14 16:43:55--  http://www.softbank.jp/
2013-12-14 16:44:00 (377 KB/s) - `response/index.html.5' へ保存終了 [43626]
--2013-12-14 16:44:00--  http://www.softbank.jp/corp/
2013-12-14 16:44:00 (460 KB/s) - `response/index.html.6' へ保存完了 [35866/35866]
--2013-12-14 16:44:00--  http://cdn.softbank.jp/corp/set/data/csr/pdf/csr2013_01.pdf
2013-12-14 16:44:07 (2.64 MB/s) - `response/csr2013_01.pdf' へ保存完了 [3378593/3378593]
終了しました --2013-12-14 16:44:07--
[root@centos64 ~]#
※レスポンス結果はその時々で変化します。
※上記はその時の結果であり、何かを保証するものではありません。

この情報が何かのお役にたてれば幸いです。m(_ _)m