LoginSignup
0
0

More than 1 year has passed since last update.

sarを自分スクリプトにしてcronで動かす

Last updated at Posted at 2021-12-01

元祖の手順書そのままで申し訳ありませんが。。。

1秒ごと かつ 1日(86400秒)で設定

loadget.sh
#!/bin/sh

/usr/bin/sar -A -o sar_`date +%Y%m%d`.txt 1 8640

cronに登録
crontab -e

1 * * * * /root/loadget.sh

吐き出したログを確認する。

CPUコアごと版

sar -P ALL -f log.txt

cpuマージ版

sar -p -f log.txt

ネットワーク

sar -n DEV -f log.txt

メモリ

sar -r -f log.txt

停止方法 ※これしか思いつかなかった。。。

ps -ef | grep sar
kill PID
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