From e5fd591f4871cf0eb1115a512db8058168941726 Mon Sep 17 00:00:00 2001 From: Ivan Ponovarev Date: Tue, 5 Mar 2013 15:45:19 +0400 Subject: [PATCH] different name for nrpe and master --- deployment/puppet/nagios/manifests/command.pp | 7 +------ .../puppet/nagios/manifests/command/commands.pp | 6 ++++-- deployment/puppet/nagios/manifests/common.pp | 2 +- .../nagios/manifests/contact/contactgroups.pp | 2 +- .../puppet/nagios/manifests/contact/contacts.pp | 2 +- .../puppet/nagios/manifests/host/hostextinfo.pp | 2 +- deployment/puppet/nagios/manifests/host/hosts.pp | 2 +- deployment/puppet/nagios/manifests/init.pp | 1 + deployment/puppet/nagios/manifests/master.pp | 14 ++++++++------ .../puppet/nagios/manifests/service/services.pp | 2 +- 10 files changed, 20 insertions(+), 20 deletions(-) diff --git a/deployment/puppet/nagios/manifests/command.pp b/deployment/puppet/nagios/manifests/command.pp index 5612d65cb3..813b0919c5 100644 --- a/deployment/puppet/nagios/manifests/command.pp +++ b/deployment/puppet/nagios/manifests/command.pp @@ -5,7 +5,7 @@ class nagios::command inherits nagios::master { } if $::osfamily == 'RedHat' { - nagios::command::commands { + nagios::command::commands { 'check_nrpe': command => '/usr/lib64/nagios/plugins/check_nrpe -H $HOSTADDRESS$ -c $ARG1$ -a $ARG2$'; 'check_nrpe_1arg': @@ -90,9 +90,4 @@ class nagios::command inherits nagios::master { nagios::command::commands { 'nrpe_check_users': command => '$USER1$/check_nrpe -H $HOSTADDRESS$ -c check_users -a $ARG1$ $ARG2$', } - - Nagios_command <||> { - notify => Exec['fix-permissions'], - require => File['conf.d'], - } } diff --git a/deployment/puppet/nagios/manifests/command/commands.pp b/deployment/puppet/nagios/manifests/command/commands.pp index 76318fc520..1f0a4c9d25 100644 --- a/deployment/puppet/nagios/manifests/command/commands.pp +++ b/deployment/puppet/nagios/manifests/command/commands.pp @@ -1,8 +1,10 @@ define nagios::command::commands( $command = false ) { - @@nagios_command { $name: + nagios_command { $name: ensure => present, command_line => $command, - target => "/etc/${nagios::params::masterdir}/${nagios::proj_name}/commands.cfg", + target => "/etc/${nagios::params::masterdir}/${nagios::master::master_proj_name}/commands.cfg", + notify => Exec['fix-permissions'], + require => File['conf.d'], } } diff --git a/deployment/puppet/nagios/manifests/common.pp b/deployment/puppet/nagios/manifests/common.pp index 18789c60de..9d6eda4d5e 100644 --- a/deployment/puppet/nagios/manifests/common.pp +++ b/deployment/puppet/nagios/manifests/common.pp @@ -20,7 +20,7 @@ class nagios::common inherits nagios { # nagios_services_export( $services, $services_list, #{ # 'hostgroup_name' => $hostgroup, -# 'target' => "/etc/${nagios::params::masterdir}/${proj_name}/${::hostname}_services.cfg" +# 'target' => "/etc/${nagios::params::masterdir}/${nagios::master_proj_name}/${::hostname}_services.cfg" #}) define runservice($service) { diff --git a/deployment/puppet/nagios/manifests/contact/contactgroups.pp b/deployment/puppet/nagios/manifests/contact/contactgroups.pp index ddde2bf95d..3b6e78200d 100644 --- a/deployment/puppet/nagios/manifests/contact/contactgroups.pp +++ b/deployment/puppet/nagios/manifests/contact/contactgroups.pp @@ -6,6 +6,6 @@ notify {$name:} nagios_contactgroup { $name: ensure => present, alias => $alias, - target => "/etc/${nagios::params::masterdir}/${nagios::master::proj_name}/contactgroups.cfg", + target => "/etc/${nagios::params::masterdir}/${nagios::master::master_proj_name}/contactgroups.cfg", } } diff --git a/deployment/puppet/nagios/manifests/contact/contacts.pp b/deployment/puppet/nagios/manifests/contact/contacts.pp index 6637bba043..5f3cbfd839 100644 --- a/deployment/puppet/nagios/manifests/contact/contacts.pp +++ b/deployment/puppet/nagios/manifests/contact/contacts.pp @@ -15,6 +15,6 @@ $group = false, email => $t_email, contactgroups => $group, use => 'generic-contact', - target => "/etc/${nagios::params::masterdir}/${nagios::master::proj_name}/contacts.cfg", + target => "/etc/${nagios::params::masterdir}/${nagios::master::master_proj_name}/contacts.cfg", } } diff --git a/deployment/puppet/nagios/manifests/host/hostextinfo.pp b/deployment/puppet/nagios/manifests/host/hostextinfo.pp index 173c376028..e5c974bacb 100644 --- a/deployment/puppet/nagios/manifests/host/hostextinfo.pp +++ b/deployment/puppet/nagios/manifests/host/hostextinfo.pp @@ -8,6 +8,6 @@ define nagios::host::hostextinfo() { icon_image_alt => $::lsbdistid, statusmap_image => $nagios::params::statusmap_image, vrml_image => "${nagios::params::distro}.png", - target => "/etc/${nagios::params::masterdir}/${nagios::proj_name}/${::hostname}_hostextinfo.cfg", + target => "/etc/${nagios::params::masterdir}/${nagios::master_proj_name}/${::hostname}_hostextinfo.cfg", } } diff --git a/deployment/puppet/nagios/manifests/host/hosts.pp b/deployment/puppet/nagios/manifests/host/hosts.pp index bde2bd9e2d..d87651c399 100644 --- a/deployment/puppet/nagios/manifests/host/hosts.pp +++ b/deployment/puppet/nagios/manifests/host/hosts.pp @@ -7,6 +7,6 @@ define nagios::host::hosts() { use => 'default-host', address => $::fqdn, host_name => $::fqdn, - target => "/etc/${nagios::params::masterdir}/${nagios::proj_name}/${::hostname}_hosts.cfg", + target => "/etc/${nagios::params::masterdir}/${nagios::master_proj_name}/${::hostname}_hosts.cfg", } } diff --git a/deployment/puppet/nagios/manifests/init.pp b/deployment/puppet/nagios/manifests/init.pp index 09d3fb6dfa..bc6faed35f 100644 --- a/deployment/puppet/nagios/manifests/init.pp +++ b/deployment/puppet/nagios/manifests/init.pp @@ -15,6 +15,7 @@ $nrpepkg = $nagios::params::nrpepkg, $nrpeservice = $nagios::params::nrpeservice, ) inherits nagios::params { + $master_proj_name = "${proj_name}_master" validate_array($services) include nagios::common diff --git a/deployment/puppet/nagios/manifests/master.pp b/deployment/puppet/nagios/manifests/master.pp index 04a284e5d1..ef0c9a23fe 100644 --- a/deployment/puppet/nagios/manifests/master.pp +++ b/deployment/puppet/nagios/manifests/master.pp @@ -32,6 +32,8 @@ $masterdir = $nagios::params::masterdir, $htpasswd_file = $nagios::params::htpasswd_file, ) inherits nagios::params { + $master_proj_name = "${proj_name}_master" + validate_hash($htpasswd) validate_hash($templateservice) validate_hash($templatehost) @@ -54,7 +56,7 @@ $htpasswd_file = $nagios::params::htpasswd_file, # Bug: 3299 exec { 'fix-permissions': - command => "chmod -R go+r /etc/${masterdir}/${proj_name}", + command => "chmod -R go+r /etc/${masterdir}/${master_proj_name}", path => ['/bin','/sbin','/usr/sbin/','/usr/sbin/'], refreshonly => true, notify => Service[$masterservice], @@ -76,7 +78,7 @@ $htpasswd_file = $nagios::params::htpasswd_file, context => "/files/etc/${masterdir}/nagios.cfg", changes => [ 'rm cfg_file[position() > 1]', - "set cfg_dir \"/etc/${masterdir}/${proj_name}\"", + "set cfg_dir \"/etc/${masterdir}/${master_proj_name}\"", 'set check_external_commands 1', ], require => Package[$nagios3pkg], @@ -89,7 +91,7 @@ $htpasswd_file = $nagios::params::htpasswd_file, incl => '/etc/nagios*/*.cfg', context => "/files/etc/${masterdir}/nagios.cfg", changes => [ - "set cfg_dir[2] \"/etc/${masterdir}/${proj_name}\"", + "set cfg_dir[2] \"/etc/${masterdir}/${master_proj_name}\"", 'set check_external_commands 1', ], require => Package[$nagios3pkg], @@ -106,15 +108,15 @@ $htpasswd_file = $nagios::params::htpasswd_file, } file { - "/etc/${masterdir}/${proj_name}/templates.cfg": + "/etc/${masterdir}/${master_proj_name}/templates.cfg": content => template('nagios/openstack/templates.cfg.erb'); - "/etc/${masterdir}/${proj_name}/hostgroup.cfg": + "/etc/${masterdir}/${master_proj_name}/hostgroup.cfg": content => template('nagios/openstack/hostgroups.cfg.erb'); "/etc/${masterdir}/${htpasswd_file}": content => template('nagios/common/etc/nagios3/htpasswd.users.erb'); } - file { "/etc/${masterdir}/${proj_name}": + file { "/etc/${masterdir}/${master_proj_name}": recurse => true, alias => 'conf.d', notify => Service[$masterservice], diff --git a/deployment/puppet/nagios/manifests/service/services.pp b/deployment/puppet/nagios/manifests/service/services.pp index 62ec1b93d8..c83329e57e 100644 --- a/deployment/puppet/nagios/manifests/service/services.pp +++ b/deployment/puppet/nagios/manifests/service/services.pp @@ -9,6 +9,6 @@ $group = false, check_command => $command, service_description => $name, host_name => $::fqdn, - target => "/etc/${nagios::params::masterdir}/${nagios::proj_name}/${::hostname}_services.cfg", + target => "/etc/${nagios::params::masterdir}/${nagios::master_proj_name}/${::hostname}_services.cfg", } }