diff --git a/manifests/main/config.pp b/manifests/main/config.pp index cb39fa2..2dec21c 100644 --- a/manifests/main/config.pp +++ b/manifests/main/config.pp @@ -7,4 +7,8 @@ class confdroid_alloy::main::config ( ) inherits confdroid_alloy::params { include confdroid_alloy::main::service + + if $ay_manage_nagios == true { + include confdroid_alloy::monitoring::target + } } diff --git a/manifests/monitoring/target.pp b/manifests/monitoring/target.pp new file mode 100644 index 0000000..f4fbc03 --- /dev/null +++ b/manifests/monitoring/target.pp @@ -0,0 +1,23 @@ +## confdroid_alloy::monitoring::target.pp +# Module name: confdroid_alloy +# Author: 12ww1160 (12ww1160@puppetsoft.com) +# @summary class manages exports for nagios monitoring +############################################################################## +class confdroid_alloy::monitoring::target ( + +) inherits confdroid_alloy::params { + if $ay_manage_nagios == true { + @@nagios_service { "check_alloy_${fqdn}": + check_command => "check_nrpe!check_alloy!${fn_procs_allowed}!alloy-server", + use => 'generic-service', + host_name => $fqdn, + notification_period => '24x7', + service_description => "${fqdn}_check_alloy", + target => $ay_target_service, + owner => 'nagios', + group => 'nagios', + mode => '0640', + contacts => $ay_target_contacts, + } + } +} diff --git a/manifests/params.pp b/manifests/params.pp index a8b7cd4..df2dc0a 100644 --- a/manifests/params.pp +++ b/manifests/params.pp @@ -17,6 +17,9 @@ # @param [String] ay_prom_max_shards the maximum number of shards to use for prometheus metrics # @param [String] ay_prom_max_samples_per_send the maximum number of samples to send # @param [String] ay_prom_batch_send_deadline the maximum time to wait before sending +# @param [Boolean] ay_manage_nagios whether to manage nagios service exports +# @param [String] ay_target_service the target file for nagios service exports +# @param [Array] ay_target_contacts the contacts for nagios service exports # @summary Class contains all parameters for the confdroid_alloy module. ############################################################################## class confdroid_alloy::params ( @@ -40,6 +43,13 @@ class confdroid_alloy::params ( String $ay_prom_max_samples_per_send = '2000', String $ay_prom_batch_send_deadline = '5s', +# nagios + Boolean $ay_manage_nagios = false, + String $ay_target_service = '/etc/nagios/conf.d/alloy_service.cfg', + Array $ay_target_contacts = ['nagiosadmin'], + + + ) { # service $ay_service = 'alloy'