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?

More than 5 years have passed since last update.

kopsで作ったクラスタでnode-exporterを動かす

Last updated at Posted at 2018-07-10

node-exporterはコンテナで動かすこともできますが、うまく扱えないメトリクスもあるので直で動かしたいと思いました。

kopsにはhooksという機能があり、任意のsystemd unitを動かすことができます。fileAssetsでcluster spec経由でファイルを作成できるので、それらを組み合わせてnode-exporterを直に動かしました。

kops update cluster

  fileAssets:
  - content: |
      curl -LO https://github.com/prometheus/node_exporter/releases/download/v0.16.0/node_exporter-0.16.0.linux-amd64.tar.gz &&
      tar xzf node_exporter-0.16.0.linux-amd64.tar.gz
      mv node_exporter-0.16.0.linux-amd64/node_exporter /usr/bin/node_exporter
    name: inst_node_exporter
    path: /usr/local/bin/inst_node_exporter
    roles:
    - Master
    - Node
  hooks:
  - manifest: |
      [Unit]
      After=network-online.target
      [Service]
      Type=oneshot
      ExecStart=/bin/bash /usr/local/bin/inst_node_exporter
      WorkingDirectory=/tmp
    name: inst_node_exporter.service
    roles:
    - Master
    - Node
  - manifest: |
      [Unit]
      After=inst_node_exporter.service
      [Service]
      Restart=always
      ExecStart=/usr/bin/node_exporter
    name: node_exporter.service
    roles:
    - Master
    - Node
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?