Skip to content

Instantly share code, notes, and snippets.

@fberndl
Last active March 4, 2020 10:45
Show Gist options
  • Save fberndl/89a189591dbef8015128f88d255ce94e to your computer and use it in GitHub Desktop.
Save fberndl/89a189591dbef8015128f88d255ce94e to your computer and use it in GitHub Desktop.
sar (once per second )

sudo apt-get install sysstat -y

OS ubuntu 19.10

FILE: /etc/cron.d/sysstat

# The first element of the path is a directory where the debian-sa1
# script is located
PATH=/usr/lib/sysstat:/usr/sbin:/usr/sbin:/usr/bin:/sbin:/bin

# Activity reports every 10 minutes everyday
*/1 * * * * root command -v debian-sa1 > /dev/null && debian-sa1 1 60

# Additional run at 23:59 to rotate the statistics file
59 23 * * * root command -v debian-sa1 > /dev/null && debian-sa1 60 2

activate sysstat (change to true)

sudo vim /etc/default/sysstat

restart services just to be sure

service sysstat restart sudo service cron reload

cleanup before test

DAY=$(date -d "$D" '+%02d'); rm /var/log/sysstat/sa$DAY

Create SVG using sadf (INFO: saXX where XX is day)

if=eth3; DAY=$(date -d "$D" '+%02d'); sadf -g /var/log/sysstat/sa$DAY -- -n DEV --iface=$if > output.svg eog output.svg

Create CSV file

cleanup before test

if=eth3; DAY=$(date -d "$D" '+%02d'); sadf -d /var/log/sysstat/sa$DAY -- -n DEV --iface=$if > output.csv libreoffice --calc output.csv

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment