From 8b66047f8bf6c1c3c70e34d0145d4b5af5d139d0 Mon Sep 17 00:00:00 2001 From: Matt Taggart Date: Thu, 29 Sep 2016 13:09:22 -0700 Subject: make file a non-virtual resource this check_mk local plugin file resource doesn't need to be a virtual resource, I suspect the "@" was just a typo since it doesn't seem to be 'realize'd or used in any collectors. Also remove the tag since it's not used anywhere. --- manifests/agent/install_local.pp | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) (limited to 'manifests') diff --git a/manifests/agent/install_local.pp b/manifests/agent/install_local.pp index 7238440..6450abd 100644 --- a/manifests/agent/install_local.pp +++ b/manifests/agent/install_local.pp @@ -1,12 +1,11 @@ define check_mk::agent::install_local($source=undef, $content=undef, $ensure='present') { - @file { "/usr/lib/check_mk_agent/local/${name}" : + file { "/usr/lib/check_mk_agent/local/${name}" : ensure => $ensure, owner => 'root', group => 'root', mode => '0755', content => $content, source => $source, - tag => 'check_mk::local', require => Package['check-mk-agent'], } } -- cgit v1.2.3 From 7d6e6e57f1f12702a13c326bcae13406d424a509 Mon Sep 17 00:00:00 2001 From: Matt Taggart Date: Thu, 20 Jul 2017 13:01:26 -0700 Subject: create a check_mk::params and start using it --- manifests/agent/ps.pp | 7 +++++-- manifests/agent/register.pp | 6 ++++-- manifests/config.pp | 6 +++--- manifests/init.pp | 15 ++++++++------- manifests/params.pp | 13 +++++++++++++ manifests/server/collect_ps.pp | 4 ++-- manifests/server/configure_ssh.pp | 11 +++++++---- 7 files changed, 42 insertions(+), 20 deletions(-) create mode 100644 manifests/params.pp (limited to 'manifests') diff --git a/manifests/agent/ps.pp b/manifests/agent/ps.pp index 67a999f..737cb91 100644 --- a/manifests/agent/ps.pp +++ b/manifests/agent/ps.pp @@ -1,12 +1,15 @@ define check_mk::agent::ps ( # procname and levels have defaults in check_mk::ps $procname = undef, - $levels = undef, + $levels = undef, # user is optional - $user = undef + $user = undef ) { + include check_mk::params + @@check_mk::ps { "${::fqdn}_${name}": + target => "${check_mk::params::etc_dir}/check_mk/conf.d/ps.mk", desc => $name, host => $::fqdn, procname => $procname, diff --git a/manifests/agent/register.pp b/manifests/agent/register.pp index 46cdeae..a609a45 100644 --- a/manifests/agent/register.pp +++ b/manifests/agent/register.pp @@ -1,8 +1,10 @@ class check_mk::agent::register ( $host_tags = '', - $hostname = $::fqdn -) { + $hostname = $::fqdn, + $etc_dir = $check_mk::params::etc_dir +) inherit check_mk::params { @@check_mk::host { $hostname: host_tags => $host_tags, + target => "${etc_dir}/check_mk/main.mk", } } diff --git a/manifests/config.pp b/manifests/config.pp index fba6836..39946f9 100644 --- a/manifests/config.pp +++ b/manifests/config.pp @@ -2,12 +2,12 @@ class check_mk::config ( $site, $host_groups = undef, - $etc_dir = "/omd/sites/${site}/etc", + $etc_dir = $check_mk::params::etc_dir, $nagios_subdir = 'nagios', - $bin_dir = "/omd/sites/${site}/bin", + $bin_dir = $check_mk::params::bin_dir, $use_storedconfigs = true, $inventory_only_on_changes = true -) { +) inherits check_mk::params { file { # for local check_mk checks "${etc_dir}/${nagios_subdir}/local": diff --git a/manifests/init.pp b/manifests/init.pp index 4aab837..8bba46f 100644 --- a/manifests/init.pp +++ b/manifests/init.pp @@ -4,16 +4,17 @@ class check_mk ( $host_groups = undef, $package = 'omd-0.56', $site = 'monitoring', - $workspace = '/root/check_mk', - $omd_service_name = 'omd', - $http_service_name = 'httpd', - $xinitd_service_name = 'xinetd', + $workspace = $check_mk::params::workspace, + $omd_service_name = $check_mk::params::omd_service_name, + $http_service_name = $check_mk::params::http_service_name, + $xinitd_service_name = $check_mk::params::xinetd_service_name, $omdadmin_htpasswd = undef, $use_ssh = false, - $shelluser = 'monitoring', - $shellgroup = 'monitoring', + $shelluser = $check_mk::params::shelluser, + $shellgroup = $check_mk::params::shellgroup, $use_storedconfigs = true, - $inventory_only_on_changes = true) { + $inventory_only_on_changes = true +) inherits check_mk::params { class { 'check_mk::install': filestore => $filestore, diff --git a/manifests/params.pp b/manifests/params.pp new file mode 100644 index 0000000..a499ff4 --- /dev/null +++ b/manifests/params.pp @@ -0,0 +1,13 @@ +class check_mk::params { + + $site = 'monitoring' + $etc_dir = "/omd/sites/${site}/etc" + $bin_dir = "/omd/sites/${site}/bin" + $omd_service_name = 'omd' + $http_service_name = 'httpd' + $xinitd_service_name = 'xinetd' + $shelluser = 'monitoring' + $shellgroup = 'monitoring' + $workspace = '/root/check_mk' + +} diff --git a/manifests/server/collect_ps.pp b/manifests/server/collect_ps.pp index 067a25c..84bb724 100644 --- a/manifests/server/collect_ps.pp +++ b/manifests/server/collect_ps.pp @@ -1,6 +1,6 @@ class check_mk::server::collect_ps ( - $config = "${::check_mk::config::etc_dir}/check_mk/conf.d/ps.mk" -) { + $config = "${check_mk::config::etc_dir}/check_mk/conf.d/ps.mk" +) inherit check_mk::params { # this class gets run on the check-mk server in order to collect the # stored configs created on clients and assemble the ps.mk config file diff --git a/manifests/server/configure_ssh.pp b/manifests/server/configure_ssh.pp index 987cc7a..29cf95b 100644 --- a/manifests/server/configure_ssh.pp +++ b/manifests/server/configure_ssh.pp @@ -1,15 +1,18 @@ class check_mk::server::configure_ssh ( $check_mk_tag = 'check_mk_sshkey' -) { + $etc_dir = $check_mk::params::etc_dir, + $shelluser = $check_mk::params::shelluser, + $shellgroup = $check_mk::params::shellgroup, +) inherit check_mk::params { # collect exported files from client::generate_sshkey File <<| tag == $check_mk_tag |>> # configure ssh access to agents which have 'ssh' tags - file { "${check_mk::config::etc_dir}/check_mk/conf.d/use_ssh.mk": + file { "${etc_dir}/check_mk/conf.d/use_ssh.mk": source => [ 'puppet:///modules/site_check_mk/use_ssh.mk', 'puppet:///modules/check_mk/use_ssh.mk' ], - owner => $::check_mk::shelluser, - group => $::check_mk::shellgroup, + owner => $shelluser, + group => $shellgroup, mode => '0644', notify => Exec['check_mk-refresh'] } -- cgit v1.2.3 From cac46e3649d5f190c2e8c3933c5f9af8065ebf1d Mon Sep 17 00:00:00 2001 From: Matt Taggart Date: Fri, 21 Jul 2017 11:45:15 -0700 Subject: fix syntax errors --- manifests/agent/register.pp | 2 +- manifests/server/collect_ps.pp | 2 +- manifests/server/configure_ssh.pp | 4 ++-- 3 files changed, 4 insertions(+), 4 deletions(-) (limited to 'manifests') diff --git a/manifests/agent/register.pp b/manifests/agent/register.pp index a609a45..51c803d 100644 --- a/manifests/agent/register.pp +++ b/manifests/agent/register.pp @@ -2,7 +2,7 @@ class check_mk::agent::register ( $host_tags = '', $hostname = $::fqdn, $etc_dir = $check_mk::params::etc_dir -) inherit check_mk::params { +) inherits check_mk::params { @@check_mk::host { $hostname: host_tags => $host_tags, target => "${etc_dir}/check_mk/main.mk", diff --git a/manifests/server/collect_ps.pp b/manifests/server/collect_ps.pp index 84bb724..5b8456c 100644 --- a/manifests/server/collect_ps.pp +++ b/manifests/server/collect_ps.pp @@ -1,6 +1,6 @@ class check_mk::server::collect_ps ( $config = "${check_mk::config::etc_dir}/check_mk/conf.d/ps.mk" -) inherit check_mk::params { +) inherits check_mk::params { # this class gets run on the check-mk server in order to collect the # stored configs created on clients and assemble the ps.mk config file diff --git a/manifests/server/configure_ssh.pp b/manifests/server/configure_ssh.pp index 29cf95b..3b517f7 100644 --- a/manifests/server/configure_ssh.pp +++ b/manifests/server/configure_ssh.pp @@ -1,9 +1,9 @@ class check_mk::server::configure_ssh ( - $check_mk_tag = 'check_mk_sshkey' + $check_mk_tag = 'check_mk_sshkey', $etc_dir = $check_mk::params::etc_dir, $shelluser = $check_mk::params::shelluser, $shellgroup = $check_mk::params::shellgroup, -) inherit check_mk::params { +) inherits check_mk::params { # collect exported files from client::generate_sshkey File <<| tag == $check_mk_tag |>> -- cgit v1.2.3