LoginSignup
1
0

More than 5 years have passed since last update.

topコマンドをcronに仕込んで障害調査

Posted at

障害時のログ取得

日々障害の原因調査なんかをしていると、ある特定の時間に障害が発生していることに気がつくときがある。
そんな時以下のコマンドを利用してcronに登録しておけば、PCに張り付いておかなくても良いよって話。

00 00 * * * top -b -d 30 -n 30 > top_result.txt.date "+%Y%m%d_%H%M%S"

上記は毎日0時より30秒間隔で30回topコマンドの結果をtop_result.txtに書き込んでくれる。
ログはdateコマンドで日付を入れることで世代管理。
調査が長引くようであれば、同じくcronにログローテートの設定を仕込めばOK

1
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
1
0