OP#672 add nagios monitoring

This commit is contained in:
2026-09-07 16:33:31 +02:00
parent 0108bba166
commit 94042d4eb7
3 changed files with 36 additions and 0 deletions

View File

@@ -11,4 +11,8 @@ class confdroid_puppet::main::config (
if $pt_use_r10k == true { if $pt_use_r10k == true {
include confdroid_puppet::r10k::install include confdroid_puppet::r10k::install
} }
if $pt_manage_nagios == true {
include confdroid_puppet::monitoring::target
}
} }

View File

@@ -0,0 +1,23 @@
## confdroid_puppet::monitoring::target.pp
# Module name: confdroid_puppet
# Author: 12ww1160 (12ww1160@puppetsoft.com)
# @summary class manages exports for nagios monitoring
##############################################################################
class confdroid_puppet::monitoring::target (
) inherits confdroid_puppet::params {
if $pt_manage_nagios == true {
@@nagios_service { "check_puppet_${fqdn}":
check_command => "check_nrpe!check_puppet!${pt_procs_allowed}!puppet",
use => 'generic-service',
host_name => $fqdn,
notification_period => '24x7',
service_description => "${fqdn}_check_puppet",
target => $pt_target_service,
owner => 'nagios',
group => 'nagios',
mode => '0640',
contacts => $pt_target_contacts,
}
}
}

View File

@@ -65,6 +65,9 @@
# @param [String] pt_pptdb_server_crt placeholder for the server.crt # @param [String] pt_pptdb_server_crt placeholder for the server.crt
# @param [String] pt_pptdb_server_key placeholder for the server.crt # @param [String] pt_pptdb_server_key placeholder for the server.crt
# @param [String] pt_pptdb_log_max_age the max age for puppetdb logs in days # @param [String] pt_pptdb_log_max_age the max age for puppetdb logs in days
# @param [Boolean] pt_manage_nagios whether to manage nagios settings
# @param [String] pt_target_service the nagios service config file
# @param [Array] pt_target_contacts the nagios contacts to notify
############################################################################### ###############################################################################
class confdroid_puppet::params ( class confdroid_puppet::params (
@@ -141,6 +144,12 @@ class confdroid_puppet::params (
String $pt_r10k_basedir = '/etc/puppetlabs/code/environments', String $pt_r10k_basedir = '/etc/puppetlabs/code/environments',
String $pt_r10k_webhook_port = '8085', String $pt_r10k_webhook_port = '8085',
# nagios
Boolean $pt_manage_nagios = false,
String $pt_target_service = '/etc/nagios/conf.d/puppet_service.cfg',
Array $pt_target_contacts = ['nagiosadmin'],
String $pt_procs_allowed = '1:'
) { ) {
# facts # facts
$fqdn = $facts['networking']['fqdn'] $fqdn = $facts['networking']['fqdn']