LoginSignup
0
0

More than 5 years have passed since last update.

Prometheusのすすめ - Service Discovery - EndPointが「http://:9100/metrics」になって、自分自身になってしまう件

Last updated at Posted at 2018-06-29

【問題】

以前Prometheusのすすめ - Service Discovery -にて設定したやり方だと
PublicIPを持っていないインスタンスに対してはEndPointが「http://:9100/metrics」になって
自分自身にexporterを入れてる場合に、「http://:9100/metrics」になっているインスタンスは自分自身のexporterに取得しに行ってしまう。

【解決策】

色々と悩んだ結果、PublicIPがちゃんと設定されている場合のみrelabelがされれば良いようにする。

prometheus.yml抜粋
    relabel_configs:
      - source_labels: [__meta_ec2_public_ip]
-        regex:  '(.*)'
+        regex:  '([1-9].*)'
        target_label: __address__
        replacement: '${1}:9100'
      - source_labels: [__meta_ec2_tag_Name]
        target_label: instance

これで、PublicIPを持ってないインスタンスはそのままプライベートIPになるので、問題なし。

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