Upgrade to Pro — share decks privately, control downloads, hide ads and more …

Mackerel's monitoring and checks

Sponsored · Ship Features Fearlessly Turn features on and off without deploys. Used by thousands of Ruby developers.
Avatar for i2tsuki i2tsuki
November 29, 2017

Mackerel's monitoring and checks

Monitoring Seminar in mercari で Mackerel 自身のモニタリング & 監視についてお話しました。

Avatar for i2tsuki

i2tsuki

November 29, 2017
Tweet

More Decks by i2tsuki

Other Decks in Technology

Transcript

  1. 自己紹介 大野 一樹 (@kizkoh / id:kizkoh ) 株式会社はてな Web オペレーションエンジニア

    最近は Mackerel のインフラを主にひとりで担当 Mackerel の運用しつつ ISUCON7 運営してました 2 / 20
  2. Mackerel を支える Mackerel ステージング環境と本番環境 Mackerel が動いている環境にはステージング環境と本番環境がある ステージング環境は主に社内利用や API テスト用 ステージング環境のモニタリング

    & 監視 本番 Mackerel でモニタリング & 監視 .本番環境のモニタリング & 監視 ステージング Mackerel と本番 Mackerel でモニタリング & 監視 6 / 20
  3. +α の監視 Nagios の担当箇所 Nagios からの外形監視 (pingdom, Route 53 と一緒)

    ステージングも ap-northeast-1 にある Nagios はさくらの VPS にある 移行できていない監視の例 PostgreSQL のレプリケーション遅延監視 Cron の定期実行タスクの終了ステータス監視 8 / 20
  4. Mackerel のモニタリング、監視項目の紹介 Index NLB の監視 Active Standby の監視 Kinesis Streams

    のモニタリング ネットワーク系のモニタリング TCP セッションモニタリング トラフィックモニタリング 11 / 20
  5. NLB の監視 Mackerel では NLB を使っている mackerel.io と api.mackerelio.com の前段は

    NLB NLB は ICMP に応答しない TCP には背後のインスタンスに到達して応答する なので check-tcp $ ping -c 3 api.mackerelio.com PING api.mackerelio.com (52.198.226.45) 56(84) bytes of data. --- api.mackerelio.com ping statistics --- 3 packets transmitted, 0 received, 100% packet loss, time 2047ms [plugin.checks.tcp] command = "/usr/bin/check-tcp --hostname=api.mackerelio.com --port 443 -t 10 --war notification_interval = 60 max_check_attempts = 2 12 / 20
  6. Active Standby の監視 Keepalived Active Standby を構成している Keepalived プロセスは自動起動しない インスタンスが再起動した際に

    keepalived の起動し忘れを防ぐ check-proc プラグインでプロセスの有無を監視している --vrrp オプションを付けているので vrrp_script を入れると 3 つ [plugin.checks.keepalived-procs] command = "/usr/bin/check-procs --pattern='keepalived' --critical-under=2 notification_interval = 600 max_check_attempts = 2 13 / 20
  7. ネットワーク系 Tcpeek* TCP の 3-way ハンドシェイクモニタリング Syn や Syn/Ack の再送を検知する

    /proc/net/snmp の RetransSegs に近いけど細かくした感じ ポートや宛先を絞って通信を追いたいときに便利 クラウド環境だとスイッチでモニタリングできないので便利 pandax381/tcpeek: TCP 3way-handshake monitor DSAS開発者の部屋:ログからは見えてこない高負荷サイトのボトルネック 16 / 20
  8. ネットワーク系 iptables トラフィック管理したい データ転送量がどこで発生しているかをハッキリさせる iptables のチェインの作成で取得できる iptables -N send_redis iptables

    -A send_redis -j ACCEPT iptables -N receive_redis iptables -A receive_redis -j ACCEPT iptables -A OUTPUT -p tcp --sport 6379 -j send_redis iptables -A INPUT -p tcp --dport 6379 -j receive_redis Chain receive_redis (1 references) pkts bytes target prot opt in out source destination 0 0 ACCEPT all -- * * 0.0.0.0/0 0.0.0.0/0 Chain send_redis (1 references) pkts bytes target prot opt in out source destination 0 0 ACCEPT all -- * * 0.0.0.0/0 0.0.0.0/0 18 / 20