0
0

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?

BlobStorageの使用量をaz cliでとりたい

Posted at

はじめに

普通、Blob Storageの値は、Azureポータル画面から見られるわけだけど、
数値データを収集したいのでaz cliでとる方法を調べてきました。

az cliでとるよ!

今回はaz cliでサクッととる方法を調べました。

先に結論

az loginしてから実行する
--resourceにはリソースIDを入力したらごちゃごちゃ書かなくていいので楽。

C:\Users\user>az monitor metrics list --resource "/subscriptions/XXXXXXXXXXX/resourceGroups/pro-rg-nabehiro-001/providers/Microsoft.Storage/storageAccounts/prosanabehiro001" --interval 1h --metric UsedCapacity --query "value[0].timeseries[0].data[0].average"

結果がこちら
image.png

メモ:インターバルの指定は指示に従うこと

--intervalはデフォルト値が1分となっており、その値だと、BlobStorageの場合1時間おきに値をとってるようでエラーになったのでその時の結果をおいときます

image.png

メモ2:BlobStorageのUsedCapacity全体の値

ピンポイントで値を指定する前にjsonの構造を調べたときの結果を後々のために残しておく

image.png

おわりに

Azure Monitor SDKってのがあるっぽい。
az cliだと単発になっちゃうからこれつかってガツっととれるかな?
また今度調べてみよう
https://learn.microsoft.com/en-us/python/api/overview/azure/monitor?view=azure-python

0
0
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
0
0

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?