-
Notifications
You must be signed in to change notification settings - Fork 28
/
Copy pathsystem.pp
75 lines (61 loc) · 2.05 KB
/
system.pp
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
# Collect System Metrics
class puppet_metrics_collector::system (
String $system_metrics_ensure = 'present',
String $output_dir = '/opt/puppetlabs/puppet-metrics-collector',
Integer $collection_frequency = 5, # minutes
Integer $retention_days = 90,
Integer $polling_frequency_seconds = 1,
Boolean $manage_sysstat = true,
Boolean $manage_vmware_tools = false,
String $vmware_tools_pkg = 'open-vm-tools',
) {
$scripts_dir = "${output_dir}/scripts"
# If File[$output_dir] is defined, assume that the puppet_metrics_collector
# class has defined it and the following resources in init.pp.
if !defined(File[$output_dir]) {
file { [$output_dir, $scripts_dir]:
ensure => directory,
}
file { "${scripts_dir}/create-metrics-archive":
ensure => file,
mode => '0755',
source => 'puppet:///modules/puppet_metrics_collector/create-metrics-archive'
}
file { "${scripts_dir}/metrics_tidy":
ensure => file,
mode => '0744',
source => 'puppet:///modules/puppet_metrics_collector/metrics_tidy'
}
}
file { "${scripts_dir}/system_metrics":
ensure => file,
mode => '0755',
source => 'puppet:///modules/puppet_metrics_collector/system_metrics'
}
if $manage_sysstat {
package { 'sysstat':
ensure => installed,
}
}
include puppet_metrics_collector::system::cpu
include puppet_metrics_collector::system::memory
include puppet_metrics_collector::system::processes
if $facts['virtual'] == 'vmware' {
if $manage_vmware_tools and ($system_metrics_ensure == 'present') {
ensure_packages([$vmware_tools_pkg])
}
file { "${scripts_dir}/vmware_metrics":
ensure => file,
mode => '0755',
source => 'puppet:///modules/puppet_metrics_collector/vmware_metrics'
}
contain puppet_metrics_collector::system::vmware
}
# LEGACY CLEANUP
$metric_legacy_files = [
"${scripts_dir}/generate_system_metrics",
]
file { $metric_legacy_files :
ensure => absent,
}
}