fuel-library/deployment/puppet/osnailyfacter/manifests/atop.pp
Alex Schultz 95a6dc7cc7 Remove atop logrotate configuration
The previous logrotate configuration was improperly rotating the log
file which is not necessary due to the daily restart of atop. The
binary retention is now handled via a new atop retention cron. This
change removes the atop logrotate configuration.

Change-Id: I76e3c12b46946ed7c48719f51e953528708c2d4b
Closes-Bug: 1452389
2015-06-16 20:41:35 +00:00

66 lines
1.5 KiB
Puppet

# == Class: osnailyfacter::atop
#
# Allow to install and configure atop.
#
# === Parameters
#
# [*service_enabled*]
# Enable atop service, default to true.
#
# [*service_state*]
# Start atop service, default to running.
#
# [*interval*]
# Interval between snapshots, default to 20 seconds.
#
# [*logpath*]
# Directory were the log will be saved by the service.
# Default is /var/log/atop.
#
# [*rotate*]
# How many days keep binary logs.
# Default is 7.
class osnailyfacter::atop (
$service_enabled = true,
$service_state = 'running',
$interval = '20',
$logpath = '/var/log/atop',
$rotate = '7',
) {
$conf_file = $::osfamily ? {
'Debian' => '/etc/default/atop',
'RedHat' => '/etc/sysconfig/atop',
default => fail('Unsupported Operating System.'),
}
package { 'atop':
ensure => 'installed',
} ->
file { $conf_file:
ensure => present,
content => template('osnailyfacter/atop.erb'),
} ~>
service { 'atop':
ensure => $service_state,
enable => $service_enabled,
} ~>
exec { "ln -s ${logpath}/atop_current":
command => "ln -s ${logpath}/atop_$(date +%Y%m%d) ${logpath}/atop_current",
path => ['/bin', '/usr/bin'],
unless => "test -L ${logpath}/atop_current",
require => Service['atop'];
}
# This file is used for atop binary log rotations by (ana)cron
file { '/etc/cron.daily/atop_retention':
owner => 'root',
group => 'root',
mode => '0755',
content => template('osnailyfacter/atop_retention.erb'),
}
}