different name for nrpe and master

This commit is contained in:
Ivan Ponovarev 2013-03-05 15:45:19 +04:00
parent 349fde79dd
commit e5fd591f48
10 changed files with 20 additions and 20 deletions

View File

@ -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'],
}
}

View File

@ -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'],
}
}

View File

@ -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) {

View File

@ -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",
}
}

View File

@ -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",
}
}

View File

@ -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",
}
}

View File

@ -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",
}
}

View File

@ -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

View File

@ -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],

View File

@ -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",
}
}