1

I want it to give me all the sar/sadc options, interrupts,disk,etc.. every 10 seconds starting at noon for the entire hour. On the second line I want to capture the info in /proc/interrupts every minute for the hour of noon in a log file. Please verify the syntax.

* 12 * * *  root /usr/lib64/sa/sa1 -S XALL 10 360
*/1 12 * * *  root cat /proc/interrupts >> /root/proc_int.log && date >> /root/proc_int.log
1
  • If I understood correctly your first line should be something like 0 12 * * * command. In actual state it will run sa1 command every minute for an hour. You will get 60 mails. Second line looks good for me.
    – Kalavan
    Jan 5, 2017 at 13:01

2 Answers 2

3

The sa1 command collects and stores binary data in system activity data file. The command is a kind of shell wrapper of sadc command and it accepts all its parameters. So check the sadc man page for details.

The first line above is correct as XALL means to collect all available system activities. The collection will run for 1 hour (10 * 360s = 3600s = 1h) as required. The second line is all right as well.

2

I think your entry is awesome. It collects over the full interval vs. 1 second I see everywhere else. Because, as I (Charles Stepp) have commented on the "10 Useful Sar (Sysstat) Examples for UNIX / Linux Performance Monitoring" article on the web site "The Geek Stuff":

In the crontab entry, you should not be limiting the interval to 1 second. Sar uses the same system resources no matter how long the interval is. It reads kernel values, sleeps, reads the values again and records/prints the difference value. 1 second, 10 seconds, 1200 seconds are the same as far as sar’s resource usage. 99.99% of sar’s usage is sleep, which is what the kernel does anyway when it’s not doing anything. Note below that the first sar sample of only a second showed an average cpu of 3%. The longer samples, averaging over a longer period, show that 6% is probably more of an accurate average, at this time. The web pages I’ve seen so far feed each other with this 1 second sample thing, almost like someone is afraid sar might bog the system down. It won’t. The same two sets of kernel reads happens no matter what the interval is:

time sar 1 1; time sar 10 1; time sar 100 1
Linux 2.6.18-194.el5 (blahblah) 10/07/14
12:04:51 CPU %user %nice %system %iowait %steal %idle
12:04:52 all 3.00 0.00 0.75 0.00 0.00 96.25
Average: all 3.00 0.00 0.75 0.00 0.00 96.25
sar 1 1 0.00s user 0.00s system 0% cpu 1.005 total
Linux 2.6.18-194.el5 (blahblah) 10/07/14
12:04:52 CPU %user %nice %system %iowait %steal %idle
12:05:02 all 6.21 0.00 0.93 0.20 0.00 92.67
Average: all 6.21 0.00 0.93 0.20 0.00 92.67
sar 10 1 0.00s user 0.00s system 0% cpu 10.005 total
Linux 2.6.18-194.el5 (blahblah) 10/07/14
12:05:02 CPU %user %nice %system %iowait %steal %idle
12:06:42 all 6.32 0.00 0.97 0.24 0.00 92.47
Average: all 6.32 0.00 0.97 0.24 0.00 92.47
sar 100 1 0.00s user 0.00s system 0% cpu 1:40.01 total

From the man page example it shows each hour having 3 20 minute samples. This provides accurate averaging and small sa## files. A 1 second interval each 10 minutes is 1/600th of the information available.

EXAMPLES
To create a daily record of sar activities, place the following entry
in your root or adm crontab file:
0 8-18 * * 1-5 /usr/lib/sa/sa1 1200 3 &"
1
  • Consider cleaning up this formatting, it's quite difficult to read at the moment.
    – HalosGhost
    Oct 7, 2014 at 18:21

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .