netdata のレプリケーション設定(stream)


github.com

Central netdata is here!

This is the first release that supports real-time streaming of metrics between netdata servers.

新しい機能としてstream機能が追加されました。以降に設定例を記載します。

streamにおける役割は以下の通りです。

  • headless data collector (collect and stream metrics in real-time to another netdata)
  • headless proxy (collect metrics from multiple netdata and stream them to another netdata)
  • store and forward proxy (like headless proxy, but with a local database)
  • central database (metrics from multiple hosts are aggregated)

環境

# cat /etc/centos-release
CentOS Linux release 7.3.1611 (Core) 

構成

ここでは、例として以下の構成を試します。

+-----------+     +-----------+     +-----------+
|   slave   | --> |   proxy   | --> |  central  |
+-----------+     +-----------+     +-----------+
hostname slave.example.com proxy.exmaple.com central.example.com
role headless data collector store and forward proxy central database
dashboard disabled enabled enabled
alarms disabled disabled enabled
send to backend - disabled enabled

データを送るだけのホストとプロキシ機能を提供するホスト、すべてのデータを表示管理するホストの構成です。


central database(central.example.com)

# uuidgen
31a8d192-9999-0000-1111-75c71f62b7b7
stream.conf
[31a8d192-9999-0000-1111-75c71f62b7b7]
    enabled = yes
    default history = 3600
    default memory mode = ram
    health enabled by default = auto

streamのマスターホストとしての設定です。 uuidgenコマンドでAPI_KEYを設定ファイルのセクションとして登録します。

netdata.conf
[backend]
        enabled = yes
        data source = average
        type = graphite
        destination = localhost
        prefix = netdata
        hostname = central.example.com
        update every = 10
        buffer on failures = 10
        timeout ms = 20000

バックエンドの設定です。ここでは、バックエンドのタイプにgraphiteを選択しています。

バックエンドの設定は以下をご確認ください。

www.instrumedley.net

www.instrumedley.net


store and forward proxy(proxy.example.com)

# uuidgen
61d437b-3333-4444-5555-0aeebfd8dc7c
stream.conf
[stream]
    enabled = yes
    destination = central.example.com
    api key = 31a8d192-9999-0000-1111-75c71f62b7b7
    

[d61d437b-3333-4444-5555-0aeebfd8dc7c]
    enabled = yes
    default history = 3600
    default memory mode = ram
    health enabled by default = no

マスターとスレーブ双方の機能を有効にします。[stream]セクションでは、スレーブ機能を有効にしています。

netdata.conf
[global]
    memory mode = ram

[health]
    enabled = no

[health].enablednoとして、アラーム機能を無効化しています。

headless data collector(slave.example.com)

stream.conf
[stream]
    enabled = yes
    destination = proxy.example.com
    api key = d61d437b-3333-4444-5555-0aeebfd8dc7c

スレーブ機能のみの設定です。[stream]セクションで有効化します。

netdata.conf
[global]
    memory mode = none

[health]
    enabled = no

[global].memory modenoneとして、ダッシュボード機能を無効化しています。


ダッシュボード

スレーブホストのメトリクスはマスターホストのダッシュボードから以下のURLでアクセスできます。

http://<master hostname>:19999/host/<slave hostname>/

f:id:biaxident:20170321202033p:plain

http://central.example.com:19999/にアクセスすると、my-netdataから3つのホストへのリンクが確認出来ます。 また、http://proxy.example.com:19999/では、2つのホストが確認できます。

バックエンド(graphite + grafana)

f:id:biaxident:20170321202120p:plain

3ホストのロードアベレージ(15分)を表示させてみました。

netdata v1.6.0 releasaed

github.com

netdataのバージョン 1.6.0 がリリースされました。

新たに以下のプラグインが追加されています。

  • web_log
  • freeipmi
  • nsd
  • mongodb
  • smartd_log

gunicorn_lognginx_logプラグインはweb_logプラグインに置き換えられました。

また、新しい機能としてstream機能が追加されました。

Central netdata is here!

This is the first release that supports real-time streaming of metrics between netdata servers.

www.instrumedley.net

NetData + InfluxDB + Grafana によるパフォーマンスモニタリング

www.instrumedley.net

以前、netdataのバックエンドにgraphiteを利用する方法を書きました。

今回は、graphiteではなくinfluxdbを利用してみます。

github.com

influxdbはSQLのようなクエリが利用できます。

環境

# cat /etc/centos-release
CentOS Linux release 7.3.1611 (Core) 

インストール

influxdb

# cat <<EOF >/etc/yum.repos.d/influxdb.repo
[influxdb]
name = InfluxData Repository - RHEL \$releasever
baseurl = https://repos.influxdata.com/rhel/\$releasever/\$basearch/stable
enabled = 1
gpgcheck = 1
gpgkey = https://repos.influxdata.com/influxdb.key
EOF

# yum install influxdb

grafana

# cat <<EOF > /etc/yum.repos.d/grafana.repo
[grafana]
name=grafana
baseurl=https://packagecloud.io/grafana/stable/el/7/\$basearch
repo_gpgcheck=1
enabled=1
gpgcheck=1
gpgkey=https://packagecloud.io/gpg.key https://grafanarel.s3.amazonaws.com/RPM-GPG-KEY-grafana
sslverify=1
sslcacert=/etc/pki/tls/certs/ca-bundle.crt
EOF

# yum install grafana
# systemctl daemon-reload

netdata

netdataのインストールについてはこちらを参照してください。

www.instrumedley.net

設定

influxdb(/etc/influxdb/influxdb.conf)

  [[opentsdb]]
   enabled = true
   bind-address = ":4242"
   database = "netdata"

netdata(etc/netdata/netdata.conf)

[backend]
        enabled = yes
        data source = average
        type = opentsdb
        destination = localhost:4242
        prefix = netdata
        hostname = www.example.com
        update every = 10
        buffer on failures = 10
        timeout ms = 20000

サービスの起動

# systemctl start influxdb.service 
# systemctl start grafana-server.service
# systemctl restart netdata.service

grafana の設定

f:id:biaxident:20170314205055p:plain

"data source"の追加

f:id:biaxident:20170314205123p:plain

"グラフ"の設定