Skip to content

Commit

Permalink
Enable sysstat collection
Browse files Browse the repository at this point in the history
  • Loading branch information
anayrat committed Oct 6, 2023
1 parent 434fd89 commit e9e9ad5
Show file tree
Hide file tree
Showing 4 changed files with 60 additions and 0 deletions.
9 changes: 9 additions & 0 deletions roles/common/files/sysstat-default
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
#
# Default settings for /etc/init.d/sysstat, /etc/cron.d/sysstat
# and /etc/cron.daily/sysstat files
#

# Should sadc collect system activity informations? Valid values
# are "true" and "false". Please do not put other values, they
# will be overwritten by debconf!
ENABLED="true"
31 changes: 31 additions & 0 deletions roles/common/files/sysstat.conf
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
# sysstat configuration file. See sysstat(5) manual page.

# How long to keep log files (in days).
# Used by sa2(8) script
# If value is greater than 28, then log files are kept in
# multiple directories, one for each month.
HISTORY=28

# Compress (using xz, gzip or bzip2) sa and sar files older than (in days):
COMPRESSAFTER=7

# Parameters for the system activity data collector (see sadc(8) manual page)
# which are used for the generation of log files.
# By default contains the `-S DISK' option responsible for generating disk
# statisitcs. Use `-S XALL' to collect all available statistics.
SADC_OPTIONS="-S XALL"

# Directory where sa and sar files are saved.
SA_DIR=/var/log/sysstat

# Compression program to use.
ZIP="xz"

# By default sa2 script generates yesterday's summary, since the cron job
# usually runs right after midnight. If you want sa2 to generate the summary
# of the same day (for example when cron job runs at 23:53) set this variable.
#YESTERDAY=no

# By default sa2 script generates reports files (the so called sarDD files).
# Set this variable to false to disable reports generation.
#REPORTS=false
3 changes: 3 additions & 0 deletions roles/common/tasks/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -708,5 +708,8 @@

- include: munin-node.yml

- include: sysstat.yml

- include: ntp.yml
when: "not 'vm' in group_names"

17 changes: 17 additions & 0 deletions roles/common/tasks/sysstat.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
- name: install packages for sysstat
apt: pkg={{ item }} update_cache=yes
with_items:
- sysstat
- xz
when: ansible_distribution == 'Debian' or ansible_distribution == 'Ubuntu'

- name: Enable sysstat
copy:
src: "{{ item.src }}"
dest: "{{ item.dest }}"
owner: root
mode: "{{ item.mode }}"
loop:
- { src: 'sysstat-default', dest: '/etc/default/sysstat', mode: '0644' }
- { src: 'sysstat.conf', dest: '/etc/sysstat/sysstat', mode: '0644' }
notify: restart sysstat

0 comments on commit e9e9ad5

Please sign in to comment.