Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Rename site parameter to monitoring_site #42

Closed
wants to merge 3 commits into from
Closed
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,7 @@ htpasswd -i ~/etc/passwd cmkadmin
The following example changes the default site name from 'monitoring' to 'differentsitename'
```puppet
class { 'check_mk':
site => 'differentsitename',
monitoring_site => 'differentsitename',
}
```

Expand Down
20 changes: 10 additions & 10 deletions manifests/config.pp
Original file line number Diff line number Diff line change
Expand Up @@ -5,16 +5,16 @@
#

class check_mk::config (
String $site,
String $monitoring_site,
Optional[Hash] $host_groups = undef,
Optional[Array] $all_hosts_static = undef,
) {
$etc_dir = "/omd/sites/${site}/etc"
$bin_dir = "/omd/sites/${site}/bin"
$etc_dir = "/omd/sites/${monitoring_site}/etc"
$bin_dir = "/omd/sites/${monitoring_site}/bin"
file { "${etc_dir}/nagios/local":
ensure => directory,
owner => $site,
group => $site,
owner => $monitoring_site,
group => $monitoring_site,
}

file_line { 'nagios-add-check_mk-cfg_dir':
Expand All @@ -25,8 +25,8 @@
}

concat { "${etc_dir}/check_mk/main.mk":
owner => $site,
group => $site,
owner => $monitoring_site,
group => $monitoring_site,
mode => '0644',
}

Expand All @@ -42,7 +42,7 @@
content => template('check_mk/all_hosts_static.erb'),
}

# # local list of hosts is in /omd/sites/${site}/etc/check_mk/all_hosts_static and is appended
# # local list of hosts is in /omd/sites/${monitoring_site}/etc/check_mk/all_hosts_static and is appended
concat::fragment { 'all-hosts-static':
source => "${etc_dir}/check_mk/all_hosts_static",
target => "${etc_dir}/check_mk/main.mk",
Expand Down Expand Up @@ -84,7 +84,7 @@
}
}

# # local config is in /omd/sites/${site}/etc/check_mk/main.mk.local and is appended
# # local config is in /omd/sites/${monitoring_site}/etc/check_mk/main.mk.local and is appended
file { "${etc_dir}/check_mk/main.mk.local":
ensure => file,
owner => 'root',
Expand All @@ -99,7 +99,7 @@
}

exec { 'check_mk-reload':
command => "/bin/su -l -c '${bin_dir}/check_mk --reload' ${site}",
command => "/bin/su -l -c '${bin_dir}/check_mk --reload' ${monitoring_site}",
refreshonly => true,
}

Expand Down
16 changes: 8 additions & 8 deletions manifests/init.pp
Original file line number Diff line number Diff line change
Expand Up @@ -4,19 +4,19 @@
$host_groups = $check_mk::params::host_groups,
$httpd_service = $check_mk::params::httpd_service,
$package = $check_mk::params::package,
$site = $check_mk::params::site,
$monitoring_site = $check_mk::params::monitoring_site,
$workspace = $check_mk::params::workspace,
) inherits check_mk::params {
class { 'check_mk::install':
filestore => $filestore,
package => $package,
site => $site,
workspace => $workspace,
filestore => $filestore,
package => $package,
monitoring_site => $monitoring_site,
workspace => $workspace,
}
class { 'check_mk::config':
host_groups => $host_groups,
site => $site,
require => Class['check_mk::install'],
host_groups => $host_groups,
monitoring_site => $monitoring_site,
require => Class['check_mk::install'],
}
class { 'check_mk::service':
checkmk_service => $checkmk_service,
Expand Down
6 changes: 3 additions & 3 deletions manifests/install.pp
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
#

class check_mk::install (
String $site,
String $monitoring_site,
Stdlib::Absolutepath $workspace,
Optional[String] $filestore = undef,
Optional[Pattern[/^(check-mk-(\w*))(-|_)(\d*\.\d*\.\d*p\d*).+\.(\w+)$/]] $package = undef,
Expand Down Expand Up @@ -60,9 +60,9 @@
before => Exec['omd-create-site'],
}
}
$etc_dir = "/omd/sites/${site}/etc"
$etc_dir = "/omd/sites/${monitoring_site}/etc"
exec { 'omd-create-site':
command => "/usr/bin/omd create ${site}",
command => "/usr/bin/omd create ${monitoring_site}",
creates => $etc_dir,
}
}
2 changes: 1 addition & 1 deletion manifests/params.pp
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
$package = 'check-mk-raw-1.5.0p7-el7-38.x86_64.rpm'
$filestore = undef
$host_groups= undef
$site = 'monitoring'
$monitoring_site = 'monitoring'
$workspace = '/root/check_mk'

# OS specific variables
Expand Down
4 changes: 2 additions & 2 deletions spec/classes/check_mk_config_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
on_supported_os.each do |os, os_facts|
context "with site set on #{os}" do
let(:facts) { os_facts }
let(:params) { { site: 'TEST_SITE' } }
let(:params) { { monitoring_site: 'TEST_SITE' } }

it {
is_expected.to compile
Expand Down Expand Up @@ -72,7 +72,7 @@
let(:facts) { os_facts }
let(:params) do
{
site: 'TEST_SITE',
monitoring_site: 'TEST_SITE',
host_groups: {
group1: {
host_tags: []
Expand Down
4 changes: 2 additions & 2 deletions spec/classes/check_mk_install_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
{
filestore: '/filestore/',
package: 'check-mk-raw-1.5.0p7_0.stretch_amd64.deb',
site: 'site',
monitoring_site: 'site',
workspace: '/workspace'
}
end
Expand Down Expand Up @@ -40,7 +40,7 @@
{
filestore: '/filestore/',
package: 'check-mk-raw-1.5.0p7-el7-38.x86_64.rpm',
site: 'site',
monitoring_site: 'site',
workspace: '/workspace'
}
end
Expand Down
4 changes: 2 additions & 2 deletions spec/classes/check_mk_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -11,12 +11,12 @@
it {
is_expected.to contain_class('check_mk::install').with(filestore: nil,
package: 'check-mk-raw-1.5.0p7-el7-38.x86_64.rpm',
site: 'monitoring',
monitoring_site: 'monitoring',
workspace: '/root/check_mk').that_comes_before('Class[check_mk::config]')
}
it {
is_expected.to contain_class('check_mk::config').with(host_groups: nil,
site: 'monitoring').that_comes_before('Class[check_mk::service]')
monitoring_site: 'monitoring').that_comes_before('Class[check_mk::service]')
}
it { is_expected.to contain_class('check_mk::service') }
end
Expand Down