LoginSignup
0
2

More than 5 years have passed since last update.

prometheus監視設定(Azure編)

Last updated at Posted at 2017-03-16

環境

Prometheus Server: Azure 仮想マシン上に立てたDockerコンテナ
監視対象のサーバ:Azure 仮想マシン上&および仮想マシン上のコンテナ

前書き

prometheusの検証を実施する中で設定ファイルとなるprometheus.yml の記載についてちょっと疑問が沸いたので備忘録です。
コンテナやAutoScaleに対応している監視ツール。それがPrometheusという認識から検証を開始したものの、どうやって設定ファイル記載するんだろう??

調査1:そもそも

「Prometheus オートスケール」でGoogle先生のお告げを聞くと、長生村本郷Engineers'Blog にAWS用の記載があることが判明。

 - job_name: 'node'
    ec2_sd_configs:
      - region: ap-northeast-1
        access_key: ********************
        secret_key: ****************************************
        port: 9100

これは、もしや「azure_sd_configs」もあるのか?とGoogle先生のお告げを確認・・・・あった!
Prometheus.Configuration

# The information to access the Azure API.
# The subscription ID.
subscription_id: <string>
# The tenant ID.
tenant_id: <string>
# The client ID.
client_id: <string>
# The client secret.
client_secret: <string>

# Refresh interval to re-read the instance list.
[ refresh_interval: <duration> | default = 300s ]

# The port to scrape metrics from. If using the public IP address, this must
# instead be specified in the relabeling rule.
[ port: <int> | default = 80 ]

これはそれぞれの部分に何を記載すれば、いいのかな・・・。

azure_sd_config の記載内容

Tower of Engineersにもう少し詳しく記載がありました。

AzureポータルからAzure Active Directoryを選択して、「アプリの登録」が必要そうです。
最低限必要な記載は、次の4つ。

・subscription_id → (言わずと知れた)サブスクリプションID
・tenant_id → テナントID(サブスクリプション ID に紐付くID) ※ 確認方法は、下記参照
・client_id → Azure Active Directoryのアプリ登録時に生成される AppId の値
・client_secret → Azure Active Directoryのアプリ登録時に生成される キーの値

~注意~
   client_secretは、キー作成時のみ表示されるのでしっかりとコピーしてください。
   万一忘れた場合には、キーの再作成です。

テナントID確認方法

テナントIDは、AzureCLI(PowerShell)から確認できます。

<PowerShell起動>
> Login-AzureRmAccount
Environment           : ***********
Account               : ******@*****.**
TenantId              : ********-****-****-****-************
SubscriptionId        : ********-****-****-****-************
SubscriptionName      : *********
CurrentStorageAccount :

> Get-AzureRmSubscription

SubscriptionName      : **************
SubscriptionId        : ********-****-****-****-************
TenantId              : ********-****-****-****-************
State                 : Disabled

SubscriptionName      : **************
SubscriptionId        : ********-****-****-****-************
TenantId              : ********-****-****-****-************
State                 : Enabled

参考サイト

長生村本郷Engineers'Blog
Prometheus.Configuration
Tower of Engineers

0
2
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
2