15

I want to look at disk I/O info on my machine/in general. Found some help from https://unix.stackexchange.com/questions/55212/how-can-i-monitor-disk-io

After recently installing sysstat package and attempting to use sar command (I assume) as that person did, I was instead prompted to check if data collecting was enabled in the above specified file.

After:

sudo vim /etc/default/sysstat

I changed the only line of uncommented code:

ENABLED="false"

to:

ENABLED="true"

However, I am still not able to run sar and get the expected output in my terminal.

halfer
  • 19,824
  • 17
  • 99
  • 186
David Tahvildaran
  • 307
  • 1
  • 3
  • 10

7 Answers7

16

Try restarting the service and see the data collects or not

$ sudo service sysstat restart 
Javeed Shakeel
  • 2,926
  • 2
  • 31
  • 40
13

I assume that you have installed the sysstat utility properly,

apt-get install sysstat

STEP 1

Open "/etc/default/sysstat" using your favorite file editor and change ENABLED="false" to ENABLED="true"

vim /etc/default/sysstat
----
# Should sadc collect system activity informations? Valid values
# are "true" and "false". Please do not put other values, they
# will be overwritten by debconf!
ENABLED="true"
----

STEP 2

change the collection interval from every 10 minutes to every 2 minutes. So that we get metrics for every two minutes, you can change the interval as per your need.

----
vim /etc/cron.d/sysstat
Change
5-55/10 * * * * root command -v debian-sa1 > /dev/null && debian-sa1 1 1
To
*/2 * * * * root command -v debian-sa1 > /dev/null && debian-sa1 1 1
----

STEP 3

Next we need to restart the sysstat service.

service sysstat restart
Or
/etc/init.d/sysstat restart

For reference you can click here

Liju Kuriakose
  • 445
  • 3
  • 11
4

I install sysstat when I provision new Ubuntu machines so it's scripted.

apt-get install sysstat -y
sed -i 's/false/true/g' /etc/default/sysstat
sed -i 's/5-55\/10/*\/2/g' /etc/cron.d/sysstat
service sysstat restart

In 15 minutes run this command to see some data ...
sar -d

Vituvo
  • 1,008
  • 1
  • 9
  • 29
2

Please follow the steps below to get it to work: https://www.crybit.com/sysstat-sar-on-ubuntu-debian/

Open /etc/default/sysstat using your favorite editor and change ENABLED="false" to ENABLED="true"

$ vi /etc/cron.d/sysstat

Change

5-55/10 * * * * root command -v debian-sa1 > /dev/null && debian-sa1 1 1

To:

*/2 * * * * root command -v debian-sa1 > /dev/null && debian-sa1 1 1

Then:

$ service sysstat restart
Mohammad Kholghi
  • 533
  • 2
  • 7
  • 21
Linda
  • 78
  • 7
1

just restart it to reload modified configuration :

sudo systemctl restart sysstat.service

it works for me :)

Ali
  • 11
  • 4
0

Running iostat as:

$ iostat -x 1

I was able to see the utilization of each device and can now run sar without any issues.

Stephen Rauch
  • 47,830
  • 31
  • 106
  • 135
David Tahvildaran
  • 307
  • 1
  • 3
  • 10
0

This enabled and started it:

sudo sed -i "s|ENABLED="false"|ENABLED="true"|g" /etc/default/sysstat
sudo systemctl enable sysstat && sudo systemctl start sysstat

You may need to wait like 15 minutes to start seeing sar values.

16851556
  • 255
  • 3
  • 11