2

sar man page says that one can specify the resolution in seconds for its output.
However, I am not able to get a second level resolution by the following command.

sar -i 1 -f /var/log/sa/sa18

11:00:01 AM     CPU     %user     %nice   %system   %iowait    %steal     %idle
11:10:01 AM     all      0.04      0.00      0.04      0.00      0.01     99.91
11:20:01 AM     all      0.04      0.00      0.04      0.00      0.00     99.92
11:30:01 AM     all      0.04      0.00      0.04      0.00      0.00     99.92

Following command too does not give second level resolution:

sar  -f /var/log/sa/sa18 1

I am able to get second-level result only if I do not specify the -f option:

sar 1 10
08:34:31 PM     CPU     %user     %nice   %system   %iowait    %steal     %idle
08:34:32 PM     all      0.12      0.00      0.00      0.00      0.00     99.88
08:34:33 PM     all      0.00      0.00      0.12      0.00      0.00     99.88
08:34:34 PM     all      0.00      0.00      0.12      0.00      0.00     99.88

But I want to see system performance varying by second for some past day.

How do I get sar to print second-level output with the -f option?

Linux version: Linux 2.6.32-642.el6.x86_64
sar version : sysstat version 9.0.4

user2250246
  • 3,807
  • 5
  • 43
  • 71

2 Answers2

2

I think the exist sar report file 'sa18' collected with an interval 10 mins. So we don't get the output in seconds.

Please check the /etc/cron.d/sysstat file.

[root@testserver ~]# cat /etc/cron.d/sysstat
 #run system activity accounting tool every 10 minutes
*/10 * * * * root /usr/lib64/sa/sa1 1 1
 #generate a daily summary of process accounting at 23:53
53 23 * * * root /usr/lib64/sa/sa2 -A

If you want to reduce the sar interval interval you can modify the sysstat file.

Nathan Tuggy
  • 2,237
  • 27
  • 30
  • 38
0

The /var/log/sa directory has all of the information already. The sar command serves here as a parser, and reads all data in the sa file. So you can use sar -f /var/log/sa/<sa file> to see first-level results, and use other flags, like '-r', for other results.

# sar -f /var/log/sa/sa02

12:00:01    CPU %user   %nice   %system %iowait %steal  %idle
12:10:01    all 14.70   0.00    5.57    0.69    0.01    79.03
12:20:01    all 23.53   0.00    6.08    0.55    0.01    69.83


# sar -r -f /var/log/sa/sa02

12:00:01  kbmemfree   kbavail kbmemused  kbactive   kbinact   kbdirty
12:10:01    2109732   5113616  30142444  25408240     2600
12:20:01    1950480   5008332  30301696  25580696     2260
12:30:01    2278632   5324260  29973544  25214788     4112
ouflak
  • 2,458
  • 10
  • 44
  • 49
Amit
  • 47
  • 8