Files
ubicloud/rhizome/host/bin/setup-sysstat
Hadi Moshayedi 22cf0a075e Install Sysstat.
Having access to historical performance counters will be useful when we
encounter performance issues. This PR creates a program to install
sysstat on VmHosts to enable that.

After this, sysstat will collect a performance counter samples every
minute, which can be analyzed using the sar command:

```
$ sar -f /var/log/sysstat/sa[date] [options]
```
2023-11-10 12:54:43 -08:00

27 lines
718 B
Ruby
Executable File

#!/bin/env ruby
# frozen_string_literal: true
require_relative "../../common/lib/util"
require "fileutils"
# install the package
r "apt update && apt-get install -y sysstat"
# Increase historical archive length to 60 days
r "sed -i -E 's/HISTORY=[0-9]+/HISTORY=60/g' /etc/sysstat/sysstat"
# Collect every minute. Default was every 10 minutes.
FileUtils.mkdir_p "/etc/systemd/system/sysstat-collect.timer.d/"
File.write("/etc/systemd/system/sysstat-collect.timer.d/override.conf", <<SYSSTAT_TIMER_OVERRIDE
[Unit]
Description=Run system activity accounting tool every minute
[Timer]
OnCalendar=*:00/1
SYSSTAT_TIMER_OVERRIDE
)
# Enable and start the service
r "systemctl enable sysstat"
r "systemctl start sysstat"