はじめに
この記事ではAzureまたMicrosoftの便利なCLIツールのSnapパッケージのインストール方法を紹介します。snapパケージはUbuntu 18.04とUbuntu 20.04ではこのまま使えます。
ツール
azure-cli
Azure CLI を使うと、仮想環境へのログインやリソースの作成など、Azure Portal上で行う操作がコマンドで完結できます。
最初はSnapパケージをインストールし、アリアスを作成します。
sudo snap install azure-cli-johanburati
sudo snap alias azure-cli-johanburati az
az version
LinuxではAZURE_CONFIG_DIR の既定値は$HOME/.azure
ですがsnapは.
から始まるフォルダーをアクセスできないため、$HOME/.bashrc
ファイルに次のラインを追加します。
export AZURE_CONFIG_DIR=$HOME/azure
そして、フォルダーを作ります。
mkdir $HOME/azure
そしたら、azコマンドを使えます。
$ az login
To sign in, use a web browser to open the page https://microsoft.com/devicelogin and enter the code X3L33TXXX to authenticate.
azcopy
AzCopy は、ストレージ アカウント間の BLOB またはファイル コピーに利用できるコマンドライン ユーティリティです。
最初はSnapパケージをインストールし、アリアスを作成します。
sudo snap install azcopy-johanburati
sudo snap alias azcopy-johanburati azcopy
azcopy --version
そしたら、azcopyコマンドを使って一つのファイルをブロブにアップロードします。
$ azcopy copy /etc/os-release "https://$STORAGE.blob.core.windows.net/$CONTAINER?$SAS_TOKEN"
INFO: Scanning...
INFO: Any empty folders will not be processed, because source and/or destination doesn't have full folder support
Job f0e2ba28-e108-0f47-6748-516fe54e73d3 has started
Log file is located at: /home/job/snap/azcopy-johanburati/9/.azcopy/f0e2ba28-e108-0f47-6748-516fe54e73d3.log
0.0 %, 0 Done, 0 Failed, 1 Pending, 0 Skipped, 1 Total,
Job f0e2ba28-e108-0f47-6748-516fe54e73d3 summary
Elapsed Time (Minutes): 0.0334
Number of File Transfers: 1
Number of Folder Property Transfers: 0
Total Number of Transfers: 1
Number of Transfers Completed: 1
Number of Transfers Failed: 0
Number of Transfers Skipped: 0
TotalBytesTransferred: 176
Final Job Status: Completed
ethr
Ethr はネットワーク パフォーマンス測定ツールです。
最初はSnapパケージをインストールし、アリアスを作成します。
sudo snap install ethr-johanburati
sudo snap alias ethr-johanburati ethr
そしたら、**ethr*コマンドを使えます。
使い方について、サーバー側では次のコマンドを使います。
$ ethr -s
Listening on 9999 for TCP bandwidth tests
Listening on 9998 for TCP conn/s tests
Listening on 9996 for TCP latency tests
Listening on 9899 for HTTP bandwidth tests
Listening on 9799 for HTTPS bandwidth tests
Listening on 9896 for HTTP latency tests
Listening on 8888 for control plane
New control connection from 10.1.1.7, port 59114
Starting TCP Bandwidth test from 10.1.1.7
-----------------------------------------------------------
[RemoteAddress] Proto Bits/s Conn/s Pkt/s Latency
[ 10.1.1.7] TCP 1.01G
[ 10.1.1.7] TCP 997.76M
[ 10.1.1.7] TCP 981.50M
[ 10.1.1.7] TCP 988.54M
[ 10.1.1.7] TCP 990.59M
[ 10.1.1.7] TCP 984.83M
[ 10.1.1.7] TCP 1.01G
[ 10.1.1.7] TCP 990.08M
[ 10.1.1.7] TCP 1.01G
[ 10.1.1.7] TCP 996.10M
Ending Bandwidth test from 10.1.1.7
クライアント側は以下のとおりです。(サーバーのIP:10.1.1.4)
$ ethr -c 10.1.1.4
Connecting to host [10.1.1.4], port 9999
[ 6] local 10.1.1.7 port 53116 connected to 10.1.1.4 port 9999
- - - - - - - - - - - - - - - - - - - - - - -
[ ID] Protocol Interval Bits/s
[ 6] TCP 000-001 sec 527.30M
[ 6] TCP 001-002 sec 998.14M
[ 6] TCP 002-003 sec 976.51M
[ 6] TCP 003-004 sec 989.31M
[ 6] TCP 004-005 sec 986.88M
[ 6] TCP 005-006 sec 984.83M
[ 6] TCP 006-007 sec 999.81M
[ 6] TCP 007-008 sec 1.01G
[ 6] TCP 008-009 sec 993.28M
[ 6] TCP 009-010 sec 1G
Ethr done, duration: 10s.
終わりに
すべてのsnapをアップデートするには次のコマンドを使ってください。
sudo snap refresh