How Do You Get The sar Utility to Work On Ubuntu?

Problem scenario:  On some servers you try this command: "apt-get -y install sar", but this command does not work.  On some servers with sar installed, you get an error when you run "sar".  The error says "Cannot open /var/log/sysstat/sa25: No such file or directory."

Background:  The sar utility comes from the acronym for system activity report.  It is useful in performance tuning situations.

Solution: If you type "man sar" and get a man page, then it is installed.  For these servers with a man page for "man sar," skip to the "Configuration" below.  If there is no man page for sar, issue this: apt-get -y install sysstat

Configuration:
1.a)  Edit /etc/default/sysstat.  1.b) Find the stanza that says "ENABLED='false'" and change the "false" to "true".  1.c) Save the changes and exit the file.

2)  Issue this command: systemctl stop sysstat  
If you get "bash: systemctl: command not found" see * below.

3)  Issue this command: systemctl start sysstat

* Use this command if "systemctl" is not a recognized command: service sysstat stop; service sysstat start

Leave a comment

Your email address will not be published. Required fields are marked *