Bluemix にてコマンドを使用して課金情報を取得する為には、bluemix コマンドを使用する。
Linux環境(bsh系)での使用を想定する。
プロキシ設定
インターネット接続にプロキシを使用している場合は以下の環境変数を設定する。
export https_proxy=http://proxy:80
Bluemixへログイン
bluemix コマンドを実行し、Bluemix へログインします。
bluemix login
メッセージに従い、Bluemixアカウントのメールアドレス、パスワードを入力。
Authenticating...
OK
と表示されたらログイン成功。
その後、ログインする組織とスペースを選択。
実行例
>bluemix login
'cf login' を起動しています...
API endpoint: https://api.ng.bluemix.net
Email> xxxxxxxx@xxx
Password>
Authenticating...
OK
Select an org (or press enter to skip):
1. xxxxxxxx@xxx
2. xxxxxx
Org> 2
Targeted org xxxxxxxx
Select a space (or press enter to skip):
1. dev
2. prod
Space> 1
Targeted space dev
API endpoint: https://api.ng.bluemix.net (API version: 2.54.0)
User: xxxxxxxx@xxxx
Org: xxxxxx
Space: dev
使用量情報の取得
bluemix billing(昔はbss)コマンドを実行すると、Bluemix の使用量情報が取得できる。
bluemix billing org-usage <取得対象の組織名> -r all
これにより各Runtime と Service ごとに使用量と料金が表示される。
実行例
>bluemix bss org-usage xxxxx -r all
使用量情報を取得しています...
OK
======================================================================
Bluemix Monthly Organizations Usage On October 2016
======================================================================
Runtime | Credit Card Charge
----------------------------------------------------------------------
Instance Unit Usage Current Charge Region Space
***-kenpin GB-hours 0.16 1.21 JPY us-south dev
***-knowledge GB-hours 11.88 87.30 JPY us-south prod
***-trainer GB-hours 109.94 808.09 JPY au-syd dev
***-Node-RED GB-hours 25.01 183.82 JPY au-syd dev
Containers | Credit Card Charge
----------------------------------------------------------------------
No reported containers usage at the end of the billing cycle.
Services | Credit Card Charge
----------------------------------------------------------------------
Object-Storage
Instance Plan Unit Usage Current Charge Region Space
***-Object Storage 88020d86-****-****-****-a664079ca088 Outbound gigabytes 0 0.00 JPY us-south dev
***-Object Storage 88020d86-****-****-****-a664079ca088 Gigabytes 0 0.00 JPY us-south dev
***-cf25df9c0411 23ca9aa1-****-****-****-57b7f6b338ce Outbound gigabytes 0 0.00 JPY eu-gb dev
***-cf25df9c0411 23ca9aa1-****-****-****-57b7f6b338ce Gigabytes 0 0.00 JPY eu-gb dev
compose-for-postgresql
Instance Plan Unit Usage Current Charge Region Space
PostgreSQL-knowledge ComposePostgresqlStandard Gigabytes 1 59.29 JPY us-south prod
text_to_speech
Instance Plan Unit Usage Current Charge Region Space
***-tts 280fcf67-****-****-****-d25893c947121 Characters generated 161 2.10 JPY au-syd dev
natural_language_classifier
Instance Plan Unit Usage Current Charge Region Space
***-NLC 3dfcce09-****-****-****-eee8afab0423- Instances 2.76 3556.45 JPY au-syd dev
***-nlc 3dfcce09-****-****-****-eee8afab0423- API calls 7 2.57 JPY au-syd dev
***-nlc 3dfcce09-****-****-****-eee8afab0423- Instances 1 1287.10 JPY au-syd dev
***-nlc 3dfcce09-****-****-****-eee8afab0423- API calls 1 315.00 JPY au-syd dev
cloudantNoSQLDB
Instance Plan Unit Usage Current Charge Region Space
***-Cloudant cloudant-shared Heavy API calls 247 15.75 JPY au-syd dev
***-Cloudant cloudant-shared Light API calls 0 0.00 JPY au-syd dev
***-Cloudant cloudant-shared Gigabytes 0 0.11 JPY au-syd dev
取得対象年月を指定する場合は、コマンドの末尾に-d 取得対象年月 を追加して実行。
bluemix bss org-usage <取得対象の組織名> -r all -d <取得対象年月(YYYY-MM)>
尚、billingコマンドになってからはorgs-usage-summary コマンドにより全体の総額が取得できるようになった。