Tracking historical CPU usage

In this recipe, we are going to show how to use the sar command in combination with various switches to analyze historical CPU load during some time in the past.

Getting ready

The commands used in this recipe have been performed on a CentOS Linux machine. The command output may vary in other Linux and Unix-based operating systems.

How to do it...

The sar command when used with the -u switch is used to display CPU statistics. When used this way, the sar command will report on the current day's activities.

If we are looking to analyze the CPU statistic over some time period in the past we would need to use the -f switch in conjunction with the -u switch of the sar command. The -f option is followed by the files that sar ...

Get PostgreSQL High Performance Cookbook 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.