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?

障害対応順チートシート

0
Posted at

LinuxサーバーやWeb APIで障害が起きたときに、上から順番に確認するための自分用チートシート。

基本方針は、

疎通 → ポート → 待受け → HTTP → サービス → ログ → 資源

の順に切り分ける。

# 1. ホストまで届くか
ping -c 4 example.com

# 2. 対象ポートまで届くか
nc -vz example.com 443

# 3. サーバーがそのポートを待ち受けているか
ss -lntp
ss -lntp | grep ':8080'

# 4. アプリケーションレベルで応答するか
curl -v http://localhost:8080/
curl -v https://example.com/
curl -I https://example.com/

# 5. サービスが生きているか
systemctl status myapp
systemctl is-active myapp

# 6. ログを見る
journalctl -u myapp
journalctl -u myapp -n 100
journalctl -u myapp -f
journalctl -u myapp --since "30 min ago"

# エラー・障害っぽい行を絞り込む
journalctl -u myapp --since "30 min ago" \
  | grep -Ei 'error|failed|denied|timeout'

# 少し広めに探す
journalctl -u myapp --since "30 min ago" \
  | grep -Ei 'error|fail(ed|ure)?|denied|timeout|exception|fatal|panic|oom|killed|refused'

# ヒット行の前後5行も確認する
journalctl -u myapp --since "30 min ago" \
  | grep -Ei -C 5 'error|failed|denied|timeout'

# journalctl側で重大度を絞る
journalctl -u myapp -p err
journalctl -u myapp --since "30 min ago" -p warning

# 7. リソースを見る
df -h
free -h
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?