Skip to content

Commit

Permalink
Switch to use modern facts. Fix #56
Browse files Browse the repository at this point in the history
  • Loading branch information
NITEMAN committed Jan 5, 2022
1 parent 3fb2a20 commit 77d5842
Show file tree
Hide file tree
Showing 4 changed files with 10 additions and 14 deletions.
3 changes: 1 addition & 2 deletions manifests/check/filesystem.pp
Original file line number Diff line number Diff line change
Expand Up @@ -63,7 +63,7 @@
}

if empty($_paths) {
$paths_real = keys($::mountpoints.filter |$key, $value| { !($value['filesystem'] in $monit::fs_banned_types) })
$paths_real = keys($::facts['mountpoints'].filter |$key, $value| { !($value['filesystem'] in $monit::fs_banned_types) })
}
else {
$paths_real = $_paths
Expand All @@ -85,4 +85,3 @@
}
}
}

5 changes: 2 additions & 3 deletions manifests/config.pp
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@
content => template('monit/conf_file_overrides.erb'),
}

monit::check::system {$::fqdn:
monit::check::system {$::facts['networking']['fqdn']:
ensure => $monit::system_check_ensure,
priority => '10',
group => 'system',
Expand All @@ -37,7 +37,7 @@
ensure => $monit::system_check_ensure,
priority => '10',
group => 'system',
bundle => $::fqdn,
bundle => $::facts['networking']['fqdn'],
order => 1,
paths => $monit::system_fs,
tests => [
Expand All @@ -56,4 +56,3 @@
}
create_resources('monit::check', $mychecks)
}

7 changes: 3 additions & 4 deletions manifests/init.pp
Original file line number Diff line number Diff line change
Expand Up @@ -148,9 +148,9 @@
Stdlib::Absolutepath $service_program = $monit::params::service_program,
# System resources check.
Monit::Check::Ensure $system_check_ensure = 'present',
Numeric $system_loadavg_1min = (3 * $::processorcount),
Numeric $system_loadavg_5min = (1.5 * $::processorcount),
Numeric $system_loadavg_15min = (1.5 * $::processorcount),
Numeric $system_loadavg_1min = (3 * $::facter['processors']['count']),
Numeric $system_loadavg_5min = (1.5 * $::facter['processors']['count']),
Numeric $system_loadavg_15min = (1.5 * $::facter['processors']['count']),
String $system_cpu_user = '75%',
String $system_cpu_system = '30%',
String $system_cpu_wait = '30%',
Expand Down Expand Up @@ -180,4 +180,3 @@
-> Class['monit']

}

9 changes: 4 additions & 5 deletions manifests/params.pp
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@
$check_interval = 120
$check_start_delay = 240

case $::osfamily {
case $::facts['os']['family'] {
'Debian': {
$conf_file = '/etc/monit/monitrc'
$conf_dir = '/etc/monit/conf.d'
Expand All @@ -26,9 +26,9 @@
$eventqueue = true

$service_program = '/usr/sbin/service'
case $::operatingsystem {
case $::facts['os']['name'] {
'Debian': {
if versioncmp($::lsbmajdistrelease, '8') < 0 {
if versioncmp($::facts['os']['release']['major'], '8') < 0 {
$init_system = 'sysv'
}
else {
Expand Down Expand Up @@ -65,7 +65,7 @@
$eventqueue = false

$service_program = '/sbin/service'
if versioncmp($::lsbmajdistrelease, '7') < 0 {
if versioncmp($::facts['os']['release']['major'], '7') < 0 {
$init_system = 'sysv'
}
else {
Expand All @@ -79,4 +79,3 @@
}
}
}

0 comments on commit 77d5842

Please sign in to comment.