ERROR: (smtp1.domain) : Attribute check_command defined multiple times for Nagios::Service[smtp_queue_smtp1_25] # ./modules/nagios/manifests/service/smtp.pp:23:5 at # ./modules/nagios/manifests/service/smtp.pp:57:5
This is weird because check_command is defined only once in the file for this service, and the log indicates line 57, which has definition for
Nagios::Service["smtp_tls_smtp1_25"]
but not
Nagios::Service["smtp_queue_smtp1_25"]
Here is the smtp.pp file :
# true:
# - true : check tls and plain connect *defualt*
# - false : check plain connection only
# cert_days:
# If tls is used add an additionl check
# to check for validity for cert.
# - 'absent' : do not execute that check
# - INTEGER : Minimum number of days a certificate
# has to be valid. Default: 10
define nagios::service::smtp(
$ensure = 'present',
$host = 'absent',
$port = '25',
$tls = true,
$cert_days = 10
){
$real_host = $host ? {
'absent' => $name,
default => $host
}
nagios::service{
"smtp_queue_${name}_${port}":
ensure => $ensure;
"smtp_${name}_${port}":
ensure => $ensure;
"smtp_tls_${name}_${port}":
ensure => $tls ? {
true => $ensure,
default => 'absent'
};
}
if ($cert_days == 'absent') {
nagios::service {
"smtp_tls_cert_${name}_${port}":
ensure => absent,
check_command => "check_smtp_cert!${real_host}!${port}!${cert_days}";
}
}
else {
nagios::service {
"smtp_tls_cert_${name}_${port}":
ensure => present,
check_command => "check_smtp_cert!${real_host}!${port}!${cert_days}";
}
}
if ($ensure != 'absent') {
Nagios::Service["smtp_queue_${name}_${port}"]{
check_command => "check_mailq",
use_nrpe => true
}
Nagios::Service["smtp_${name}_${port}"]{
check_command => "check_smtp!${real_host}!${port}",
}
Nagios::Service["smtp_tls_${name}_${port}"]{
check_command => "check_smtp_tls!${real_host}!${port}",
}
}
}
ERROR: (smtp1.domain) : Attribute check_command defined multiple times for Nagios::Service[smtp_queue_smtp1_25] # ./modules/nagios/manifests/service/smtp.pp:23:5 at # ./modules/nagios/manifests/service/smtp.pp:57:5
This is weird because check_command is defined only once in the file for this service, and the log indicates line 57, which has definition for
Nagios::Service["smtp_tls_smtp1_25"]
but notNagios::Service["smtp_queue_smtp1_25"]
Here is the smtp.pp file :