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

@ -90,9 +90,4 @@ class nagios::command inherits nagios::master {
nagios::command::commands { 'nrpe_check_users': nagios::command::commands { 'nrpe_check_users':
command => '$USER1$/check_nrpe -H $HOSTADDRESS$ -c check_users -a $ARG1$ $ARG2$', 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 ) { define nagios::command::commands( $command = false ) {
@@nagios_command { $name: nagios_command { $name:
ensure => present, ensure => present,
command_line => $command, 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, # nagios_services_export( $services, $services_list,
#{ #{
# 'hostgroup_name' => $hostgroup, # '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) { define runservice($service) {

View File

@ -6,6 +6,6 @@ notify {$name:}
nagios_contactgroup { $name: nagios_contactgroup { $name:
ensure => present, ensure => present,
alias => $alias, 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, email => $t_email,
contactgroups => $group, contactgroups => $group,
use => 'generic-contact', 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, icon_image_alt => $::lsbdistid,
statusmap_image => $nagios::params::statusmap_image, statusmap_image => $nagios::params::statusmap_image,
vrml_image => "${nagios::params::distro}.png", 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', use => 'default-host',
address => $::fqdn, address => $::fqdn,
host_name => $::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, $nrpeservice = $nagios::params::nrpeservice,
) inherits nagios::params { ) inherits nagios::params {
$master_proj_name = "${proj_name}_master"
validate_array($services) validate_array($services)
include nagios::common include nagios::common

View File

@ -32,6 +32,8 @@ $masterdir = $nagios::params::masterdir,
$htpasswd_file = $nagios::params::htpasswd_file, $htpasswd_file = $nagios::params::htpasswd_file,
) inherits nagios::params { ) inherits nagios::params {
$master_proj_name = "${proj_name}_master"
validate_hash($htpasswd) validate_hash($htpasswd)
validate_hash($templateservice) validate_hash($templateservice)
validate_hash($templatehost) validate_hash($templatehost)
@ -54,7 +56,7 @@ $htpasswd_file = $nagios::params::htpasswd_file,
# Bug: 3299 # Bug: 3299
exec { 'fix-permissions': 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/'], path => ['/bin','/sbin','/usr/sbin/','/usr/sbin/'],
refreshonly => true, refreshonly => true,
notify => Service[$masterservice], notify => Service[$masterservice],
@ -76,7 +78,7 @@ $htpasswd_file = $nagios::params::htpasswd_file,
context => "/files/etc/${masterdir}/nagios.cfg", context => "/files/etc/${masterdir}/nagios.cfg",
changes => [ changes => [
'rm cfg_file[position() > 1]', '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', 'set check_external_commands 1',
], ],
require => Package[$nagios3pkg], require => Package[$nagios3pkg],
@ -89,7 +91,7 @@ $htpasswd_file = $nagios::params::htpasswd_file,
incl => '/etc/nagios*/*.cfg', incl => '/etc/nagios*/*.cfg',
context => "/files/etc/${masterdir}/nagios.cfg", context => "/files/etc/${masterdir}/nagios.cfg",
changes => [ changes => [
"set cfg_dir[2] \"/etc/${masterdir}/${proj_name}\"", "set cfg_dir[2] \"/etc/${masterdir}/${master_proj_name}\"",
'set check_external_commands 1', 'set check_external_commands 1',
], ],
require => Package[$nagios3pkg], require => Package[$nagios3pkg],
@ -106,15 +108,15 @@ $htpasswd_file = $nagios::params::htpasswd_file,
} }
file { file {
"/etc/${masterdir}/${proj_name}/templates.cfg": "/etc/${masterdir}/${master_proj_name}/templates.cfg":
content => template('nagios/openstack/templates.cfg.erb'); 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'); content => template('nagios/openstack/hostgroups.cfg.erb');
"/etc/${masterdir}/${htpasswd_file}": "/etc/${masterdir}/${htpasswd_file}":
content => template('nagios/common/etc/nagios3/htpasswd.users.erb'); content => template('nagios/common/etc/nagios3/htpasswd.users.erb');
} }
file { "/etc/${masterdir}/${proj_name}": file { "/etc/${masterdir}/${master_proj_name}":
recurse => true, recurse => true,
alias => 'conf.d', alias => 'conf.d',
notify => Service[$masterservice], notify => Service[$masterservice],

View File

@ -9,6 +9,6 @@ $group = false,
check_command => $command, check_command => $command,
service_description => $name, service_description => $name,
host_name => $::fqdn, 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",
} }
} }