-
Notifications
You must be signed in to change notification settings - Fork 70
Description
Hi,
I'm trying to add new checks. My definitions (for example that manifests/check/tcp.pp below) work good:
define nagios::check::tcp (
$ensure = undef,
$args,
) {
Required plugin
if $ensure != 'absent' {
Package <| tag == 'nagios-plugins-tcp' |>
}
nagios::client::nrpe_file { "check_tcp_${title}":
ensure => $ensure,
args => $args,
plugin => "check_tcp",
}
nagios::service { "check_tcp_${title}${::nagios::client::host_name}":
ensure => $ensure,
check_command => "check_nrpe_tcp${title}",
service_description => "${title}",
servicegroups => $servicegroups,
check_period => $check_period,
contact_groups => $contact_groups,
first_notification_delay => $first_notification_delay,
notification_period => $notification_period,
max_check_attempts => $max_check_attempts,
use => $use,
}
}
And I call that definition like that:
nagios::check::tcp { 'sonar':
args => hiera(nagios::check::sonar::args,"-p 9002"),
}
No problem up to here: Nrpe check is created on the client side and service definition is created on the server side as expected. My problem is, I have to add the command definition to manifests/server.pp manually to get it created on server side:
nagios_command { 'check_nrpe_tcp_sonar':
command_line => "${nrpe} -c check_tcp_sonar",
}
How can I do it from check manifest (manifests/check/tcp.pp) automaticaly? I tried nagios_command and @@nagios_command but i couldn't do what I need. I need something like nagios::service. Is it also supported in module? Could somebody help?