How it works...

By default, sar operates in CPU mode. Simply using the command as named, we will receive CPU activity samples for every 10 minutes of the current day. Once sar produces this output, it exits. If we want the current data, we must invoke it much like we did with iostat.

In our second example, we've chosen to emulate the iostat output by providing a summary of disk activity every 5 seconds until we cancel the command. The -d argument tells sar to display the disk statistics. Just like iostat, sar accepts two optional parameters for interval and count. As we didn't specify a count, sar will print disk performance every 5 seconds.

The third example is where we finally begin leveraging the real power of sar. If we had examined our ...

Get PostgreSQL High Availability Cookbook - Second Edition now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.