Hello guys,
cat init.pp
class hyprn_omd {
$omd_host = hiera('omd_host', {} )
create_resources(hyprn_omd::omd_create::omd_services, $omd_host)
$omd_service = $omd_host['omd_services']
create_resources(hyprn_omd::omd_create::omd_services, $omd_service)
}
cat omd_services.pp
define hyprn_omd::omd_create::omd_services (
$omd_site = undef,
$omd_ip = undef,
$omd_service = undef,
$omd_command = undef,
$omd_tag = undef,
) {
# Call omd_site which will create an OMD 'site'
include hyprn_omd::omd_create::omd_site
# Add the host to the OMD 'site'
omd::check_mk::addhost{$omd_ip: site=> 'test', tag=>'test'}
# Name the service and allocate the command
omd::nagios::command {$omd_service: site=>'test', command => '/usr/lib/nagios/plugins/check_phpfpm_status.pl -H \$ARG1$ -s \$ARG2$'}
# Add the service to the host
omd::check_mk::legacy::service {$omd_service:
site=> 'test',
command => $omd_command,
mk_hosts=> [$omd_ip],
}
}
and this is my Hiera:
omd_host:
first_host:
omd_site: 'test'
omd_ip: '10.0.0.1'
omd:
omd_service: 'check_phpfpm_status'
omd_command: 'check_phpfpm_status'
omd:
omd_service: 'check_phpfpm_status1'
omd_command: 'check_phpfpm_status'
However, it is complaining saying the following:
Error: Could not retrieve catalog from remote server: Error 400 on SERVER: create_resources(): second argument must be a hash at /etc/puppet/environments/development/modules/hyprn_omd/manifests/init.pp:24 on node omdptest
Warning: Not using cache on failed catalog
Error: Could not retrieve catalog; skipping run
Thank you,
Regards,
Sergiu