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.

prometheusAdvent Calendar 2017

Day 4

prometheusを1系の最新にversion up

Last updated at Posted at 2017-12-03

はじめに

prometheus 2.0がでましたね。後方互換性ないのでversion up大変そうだなとと思いつつ、そもそも1系の最新(2017/12現在で1.8.2)とかにもできてない。
なので1.8.2にとりまあげてみる(from 手元の環境が1.6.1)。
バイナリを最新にするだけではある。

ついでにalertmanagerも0.5.1-> 0.11.0へ。

注意点

  • 流れ
    • 新しいバイナリDL
    • バックアップいい感じにとる
    • data/とconfig関連のものだけ新しいのに移す
    • 動作確認
  • 環境
    • ubuntu 16 on EC2
    • ディレクトリ構成は以下とかになっているとする
      • /hoge/prometheus
      • /hoge/alertmanager
  • バイナリの取得方法
  • 起動
    • 今回は./prometheus &./alertmanager &的に起動
    • serviceなりsupervisorctlなりで管理してる場合はお好きに

雑手順

### current version
$ cd /hoge/prometheus
$ ./prometheus --version
prometheus, version 1.6.1 (branch: master, revision: 4666df502c0e239ed4aa1d80abbbfb54f61b23c3)
  build user:       root@ca1b452514b7
  build date:       20170419-13:26:24
  go version:       go1.8.1
$ cd /hoge/alertmanager
$ ./alertmanager --version
alertmanager, version 0.5.1 (branch: master, revision: 0ea1cac51e6a620ec09d053f0484b97932b5c902)
  build user:       root@fb407787b8bf
  build date:       20161125-08:14:40
  go version:       go1.7.3

### dl latest bin for prometheus / alertmanager
$ cd /tmp/
$ wget https://github.com/prometheus/prometheus/releases/download/v1.8.2/prometheus-1.8.2.linux-amd64.tar.gz
$ wget https://github.com/prometheus/alertmanager/releases/download/v0.11.0/alertmanager-0.11.0.linux-amd64.tar.gz
$ ls
alertmanager-0.11.0.linux-amd64.tar.gz prometheus-1.8.2.linux-amd64.tar.gz
$ tar xvf prometheus-1.8.2.linux-amd64.tar.gz
$ tar xvf alertmanager-0.11.0.linux-amd64.tar.gz

### stop current process & get backup
$ cd /hoge
$ pkill prometheus
$ pkill alertmanager
$ ls
alertmanager  prometheus
$ mv prometheus.bak prometheus.old
$ mv alertmanager alertmanager.old
$ ls
alertmanager.old prometheus.old
$ cp -r /tmp/prometheus-1.8.2.linux-amd64 ./prometheus
$ cp -r /tmp/alertmanager-0.11.0.linux-amd64 ./alertmanager
$ ls
alertmanager  alertmanager.old prometheus  prometheus.old

### migrate to latest bin w/ previous data/ & configs for prometheus

$ cd prometheus/
$ mv prometheus.yml prometheus.yml.org
$ cp -r ../prometheus.old/data/ .
$ cp ../prometheus.old/prometheus.yml .
$ cp -r ../prometheus.old/alert_rules/ .
---
# notes
I am including alert rule files as following in prometheus.yml.
rule_files:
  - 'alert_rules/*.rule'
---

### migrate to latest bin w/ previous data/ & configs for alertmanager
$ cd ../alertmanager
$ mv simple.yml simple.yml.org
$ cp ../alertmanager.old/simple.yml .
$ cp -r ../alertmanager.old/data/ .

### start them

$ cd /hoge/alertmanager
$ ./alertmanager -config.file=simple.yml > alertmanager.log 2>&1 &
$ cd /hoge/prometheus
$ ./prometheus -alertmanager.url=http://localhost:9093/

### current version
$ ./prometheus --version
prometheus, version 1.8.2 (branch: HEAD, revision: 5211b96d4d1291c3dd1a569f711d3b301b635ecb)
  build user:       root@1412e937e4ad
  build date:       20171104-16:09:14
  go version:       go1.9.2
$ ./alertmanager --version
alertmanager, version 0.11.0 (branch: HEAD, revision: 30dd0426c08b6479d9a26259ea5efd63bc1ee273)
  build user:       root@3e103e3fc918
  build date:       20171116-17:43:56
  go version:       go1.9.2

### open web UI by your browser & confirm post metrics data
# http://{your_ip}:9090
# http://{your_ip}:9093

おわりに

基本バイナリ更新だけですればよく問題なさげ。
しかし地味に手作業はめんどいのでapt-getとかyumでぱぱっとやりたい感じもある。
あるいはdockerでうにょるか。

なお、prometheusのchangelog(1.6.2->1.8.2)とalertmanager(0.5.1-> 0.11.0)を眺めてみた。prometheusはちょっと?alertmanagerはだいぶ変わった感あるが、パフォーマンス差分とかどんな感じだろか。

以上。

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?