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] ```
27 lines
718 B
Ruby
Executable File
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"
|