593 Views
June 04, 19
スライド概要
Prometheus Tokyo Meetup #2 での発表資料
Prometheusを利用し、ヤフーのデータセンターで運用中のNW機器の監視しているのか。
利用する上での工夫点などを紹介しています。
2023年10月からSpeaker Deckに移行しました。最新情報はこちらをご覧ください。 https://speakerdeck.com/lycorptech_jp
データセンターネットワークでのPrometheus活用事例 2019年6月4日 ヤフー株式会社 安藤 格也 Copyright (C) 2019 Yahoo Japan Corporation. All Rights Reserved.
安藤 格也 ・ ヤフー株式会社 サイトオペレーション本部 主な仕事 ・ データセンターネットワーク構築・運用 ・ ネットワーク設計 ・ ネットワーク関連のアプリケーション開発 2
データセンターネットワーク 3
データセンターネットワーク 弊社 Lab環境 Traffic Generator Switch Switch Server 4
Prometheus構成 Global Federation Datacenter A Datacenter N Datacenter Z 5
Prometheus構成 ・ Network機器のMetrics数の量 ・ インターフェース数の多さ ・ 物理インターフェース ・ 論理インターフェース ・ インターフェース毎に保持するデータの多さ ・ トラフィック(in, out) ・ パケット数(in, out) ・ ステータス ・ などなど 7
Prometheus構成 Global Down Sampling Global Query Long Term Federation Datacenter A Datacenter N Datacenter Z Thanos 8
Prometheusの活用範囲 ・ 死活監視 ・ リソース監視 ・ ログ監視 ・ アプリケーション監視 9
死活監視 ・ blackbox_exporterを利用 ・ ICMP監視 ・ DNS監視 ・ HTTP(S)監視 ・ 疎通性 ・ レイテンシー Datacenter 2 Prometheus blackbox_exporter Datacenter 1 Prometheus blackbox_exporter 全NW機器 data-plane control-plane L2 Datacenter 3 Prometheus blackbox_exporter Prometheus blackbox_exporter 10
ネットワークの種類 ・ Data Plane ・ サービス用ネットワーク ・ サーバーから出るトラフィック ・ Control Plane ・ 管理用ネットワーク ・ NW機器管理やコンソール用 ToRの例 DownLink UpLink DownLink Data Plane Control Plane mgmt 11
死活監視 ・ blackbox_exporterを利用 ・ ICMP監視 ・ DNS監視 ・ HTTP(S)監視 ・ 疎通性 ・ レイテンシー Datacenter 2 Prometheus blackbox_exporter Datacenter 1 Prometheus blackbox_exporter 全NW機器 data-plane control-plane L2(同subnet) Datacenter 3 Prometheus blackbox_exporter Prometheus blackbox_exporter 12
死活監視 ・ 複数のデータソース(別データセンタ)とL2(同じsubnet内)、す べてのパケットが落ちたらアラート ・ 一部のデータソースから、パケットが落ち続けたらアラート ・ レイテンシーが悪化してたらアラート ・ フルリゾルバに対して、名前解決に失敗したらアラート ・ 一般のインターネット回線からトップページなど開けなかったら アラート 13
Inhibit rule
Datacenter 1
Prometheus
blackbox_exporter
Datacenter 2
Prometheus
blackbox_exporter
あるNW機器
L2(同subnet)
data-plane
control-plane
Datacenter 3
Prometheus
blackbox_exporter
PingError (0 active)
alert: PingError
expr: count
by(instance, env) (probe_success{
== 0) >= 1
for: 1m
labels:
group: ping
severity: warning
team: dcnw
annotations:
description: '{{ $labels.instance }}'
external_url:
$labels.instance }}
title: PING監視(一部の端末からのPINGが落ちて
14
Inhibit rule
Datacenter 1
Prometheus
blackbox_exporter
Datacenter 2
Prometheus
blackbox_exporter
あるNW機器
L2(同subnet)
data-plane
control-plane
Datacenter 3
Prometheus
blackbox_exporter
PingError (0 active)
alert: PingError
expr: sum
by(instance, env) (probe_success{
== 0
labels:
group: ping
severity: critical
team: dcnw
annotations:
description: '{{ $labels.instance }}'
external_url:
$labels.instance }}
title: PING監視
15
Inhibit rule 重大度の高いアラートのみ通知 アラートルールA アラートルールB 16
Inhibit rule
groupとseverityにより、アラートの抑止が可能に
-> アラートを細かくしても邪魔にならない
PingError (0 active)
alert: PingError
expr: sum
by(instance, env) (probe_success{
== 0
labels:
group: ping
severity: critical
team: dcnw
annotations:
description: '{{ $labels.instance }}'
external_url:
$labels.instance }}
title: PING監視
PingError (0 active)
alert: PingError
expr: count
by(instance, env) (probe_success{
== 0) >= 1
for: 1m
labels:
group: ping
severity: warning
team: dcnw
annotations:
description: '{{ $labels.instance }}'
external_url:
/dashboard/db,
$labels.instance }}
title: PING監視(一部の端末からのPINGが落ちています。)
inhibit_rules:
- source_match:
severity: critical
target_match_re:
severity: ^(?:(warning|notice|debug
equal:
- group
- instance
17
リソース監視 ・ 各種Exporterを利用 ・ snmp_exporter ・ node_exporter ・ custom_exporter (独自) ・ switch_exporter ・ lb_exporter ・ トラフィック情報 ・ CPU、メモリなどの情報 ・ OSイメージ情報、UPTIME ・ モジュール情報 ・ リンク情報 Big Vendor snmpd sshd httpd White Box Switch snmpd node_exporter Prometheus snmp_exporter Prometheus custom_exporter Testing 18
リソース監視 ・ CPU、メモリー使用率の上昇監視 ・ バッファー溢れ数の上昇監視 ・ 破損パケット数上昇監視 ・ 電源故障監視 ・ 温度監視 19
Switch / colo host es- interface Ethernet ALERT 作業 ログイン IF Down/Up Log i サーバー詳細 収容情報サーバー i UPTIME(参考程度) Cisco NX-OS(tm) nxos. , Software (nxos), Version RELEASE SOFTWARE Copyright (c) CPU usage 25% 20% 15% 10% 5% 20:30 20:40 20:50 21:00 21:10 21:20 - 22: Module-1 48x10GT + 6x40G/100G Ethernet Module 6.00% 22.00% 9.02% Memory usage 21.32500% 21.32000% 21.31500% 21.31000% 21.30500% 21.30000% 21.29500% 20:30 20:40 20:50 21:00 21:10 21:20 - 22: Module-1 48x10GT + 6x40G/100G Ethernet Module 21.2973818% 21.3198716% Ping Results 150 ms 100 ms 50 ms 0 ns 20:30 20:40 20:50 21:00 21:10 21:20 Avg: 667 µs In Traffic 250 kbps 200 kbps 150 kbps 100 kbps 50 kbps 0 bps 20:25 20:30 20:35 20:40 20:45 20:50 20:55 21:00 21:05 21:10 21:15 21:20 - 対向 :Ethernet1/1 2.3 kbps 236.2 kbps 15.0 kbps 5.6 kbps 3.6270 Mbps - Ethernet1/28(vPC328) 0 bps 88.2 kbps 2.8 kbps 187 bps 676.0 kbps Out Traffic 200 kbps 150 kbps 100 kbps 50 kbps 0 bps 20:25 20:30 20:35 20:40 20:45 20:50 20:55 21:00 21:05 21:10 21:15 21:20 - Ethernet1/49( Eth1/1 vPC101) 2.0 kbps 182.4 kbps 15.2 kbps 6.1 kbps 3.6801 Mbps - 対向 Ethernet1/1 8.5 kbps 33.2 kbps 17.3 kbps 28.2 kbps 4.1938 Mbps PacketDrop In Discards(トラフィック溢れ) 1.00 0.75 0.50 0.25 0 Out Discards(トラフィック溢れ) 1.00 0.75 0.50 0.25 0 20
Switch / colo host es- interface Ethernet ALERT 作業 ログイン IF Down/Up Log i サーバー詳細 収容情報サーバー i UPTIME(参考程度) Cisco NX-OS(tm) nxos. , Software (nxos), Version RELEASE SOFTWARE Copyright (c) CPU usage 25% 20% 15% 10% 5% 20:30 20:40 20:50 21:00 21:10 21:20 - 22: Module-1 48x10GT + 6x40G/100G Ethernet Module 6.00% 22.00% 9.02% Memory usage 21.32500% 21.32000% 21.31500% 21.31000% 21.30500% 21.30000% 21.29500% 20:30 20:40 20:50 21:00 21:10 21:20 - 22: Module-1 48x10GT + 6x40G/100G Ethernet Module 21.2973818% 21.3198716% Ping Results 150 ms 100 ms 50 ms 0 ns 20:30 20:40 20:50 21:00 21:10 21:20 Avg: 667 µs In Traffic 250 kbps 200 kbps 150 kbps 100 kbps 50 kbps 0 bps 20:25 20:30 20:35 20:40 20:45 20:50 20:55 21:00 21:05 21:10 21:15 21:20 - 対向 :Ethernet1/1 2.3 kbps 236.2 kbps 15.0 kbps 5.6 kbps 3.6270 Mbps - Ethernet1/28(vPC328) 0 bps 88.2 kbps 2.8 kbps 187 bps 676.0 kbps Out Traffic 200 kbps 150 kbps 100 kbps 50 kbps 0 bps 20:25 20:30 20:35 20:40 20:45 20:50 20:55 21:00 21:05 21:10 21:15 21:20 - Ethernet1/49( Eth1/1 vPC101) 2.0 kbps 182.4 kbps 15.2 kbps 6.1 kbps 3.6801 Mbps - 対向 Ethernet1/1 8.5 kbps 33.2 kbps 17.3 kbps 28.2 kbps 4.1938 Mbps PacketDrop In Discards(トラフィック溢れ) 1.00 0.75 0.50 0.25 0 Out Discards(トラフィック溢れ) 1.00 0.75 0.50 0.25 0 21
リソース監視 インターフェース数が 多いため、選択するの が面倒 Tagsを活用するため metric_relabel_configsでtagを付与 metric_relabel_configs: - source_labels: [ifDescr] separator: ; regex: ^([^0-9]*)[0-9].*$ target_label: type replacement: $1 action: replace 22
Switch / colo host es- interface Ethernet ALERT 作業 ログイン IF Down/Up Log i サーバー詳細 収容情報サーバー i UPTIME(参考程度) Cisco NX-OS(tm) nxos. , Software (nxos), Version RELEASE SOFTWARE Copyright (c) CPU usage 25% 20% 15% 10% 5% 20:30 20:40 20:50 21:00 21:10 21:20 - 22: Module-1 48x10GT + 6x40G/100G Ethernet Module 6.00% 22.00% 9.02% Memory usage 21.32500% 21.32000% 21.31500% 21.31000% 21.30500% 21.30000% 21.29500% 20:30 20:40 20:50 21:00 21:10 21:20 - 22: Module-1 48x10GT + 6x40G/100G Ethernet Module 21.2973818% 21.3198716% Ping Results 150 ms 100 ms 50 ms 0 ns 20:30 20:40 20:50 21:00 21:10 21:20 Avg: 667 µs In Traffic 250 kbps 200 kbps 150 kbps 100 kbps 50 kbps 0 bps 20:25 20:30 20:35 20:40 20:45 20:50 20:55 21:00 21:05 21:10 21:15 21:20 - 対向 :Ethernet1/1 2.3 kbps 236.2 kbps 15.0 kbps 5.6 kbps 3.6270 Mbps - Ethernet1/28(vPC328) 0 bps 88.2 kbps 2.8 kbps 187 bps 676.0 kbps Out Traffic 200 kbps 150 kbps 100 kbps 50 kbps 0 bps 20:25 20:30 20:35 20:40 20:45 20:50 20:55 21:00 21:05 21:10 21:15 21:20 - Ethernet1/49( Eth1/1 vPC101) 2.0 kbps 182.4 kbps 15.2 kbps 6.1 kbps 3.6801 Mbps - 対向 Ethernet1/1 8.5 kbps 33.2 kbps 17.3 kbps 28.2 kbps 4.1938 Mbps PacketDrop In Discards(トラフィック溢れ) 1.00 0.75 0.50 0.25 0 Out Discards(トラフィック溢れ) 1.00 0.75 0.50 0.25 0 23
リソース監視 ・ GrafanaのAnnotationsを活用し、イベント情報を表示 Prometheusアラート 投入した設定 syslog 24
サービスディスカバリー ・ 監視対象の動的な追加を実施するため、社内のCMDBからFileSD 用のファイルを生成 ・ CMDBの中でIPAMの情報も保持している(Data Plane, Control Planeなどの情報を付与) servicein CMDB 25
ChatOps ・ ChatBotからAlertmanagerのAPIを利用 kando (安藤 格也) ある日、森の中、k、に出会った、ふかふか hubot silent do instance hostname お便り君 @kando 2時間後まで黙認します。 http://alertmanager :9093/#/silences/a631eacc-8c0e-4e86-9cf7-5472f9076cda kando (安藤 格也) ある日、森の中、k、に出会った、ふかふか hubot serviceout hogehoge お便り君 @kando hogehogeを2時間黙認しました。 http://alertmanager :9093/#/silences/a49eea24-76cc-4864-9c9e-ed31ab6841de サービスアウトジョブも登録しました。 http:// /job/server_service_out/274/console 会話をみる 26
まとめ ・ データセンター毎にPrometheusを立てている ・ 死活監視ではblackbox_exporterを利用 ・ リソース監視ではsnmp_exporterを基本として、他の exporterも利用している ・ Grafanaでの可視化のためにLabel情報を適宜変更している ・ PrometheusはVM、コンテナだけでなくネットワーク監視でも 利用できる! 27
ご清聴いただき ありがとうございました Copyright (C) 2019 Yahoo Japan Corporation. All Rights Reserved.