OP#483 add target for nagios

This commit is contained in:
2026-03-11 14:27:05 +01:00
parent 04b3f90ee2
commit 41285c88b5
3 changed files with 36 additions and 0 deletions

View File

@@ -51,6 +51,8 @@ Service
- manage service status - manage service status
Sometimes it is required to have the service on a host stopped for some reason, i.e. for troubleshooting fail2ban. In that case you can simply set `fn_enable_service`to `stopped` via ENC.
## Dependencies ## Dependencies
All dependencies must be included in the catalogue. All dependencies must be included in the catalogue.

View File

@@ -0,0 +1,23 @@
## confdroid_fail2ban::monitoring::target.pp
# Module name: confdroid_fail2ban
# Author: 12ww1160 (12ww1160@puppetsoft.com)
# @summary class manages exports for nagios monitoring
##############################################################################
class confdroid_fail2ban::monitoring::target (
) inherits confdroid_fail2ban::params {
if $fn_incl_target == true {
@@nagios_service { "check_fail2ban_${fqdn}":
check_command => 'check_procs -c 1:1 -a fail2ban-server',
use => 'generic-service',
host_name => $fqdn,
notification_period => '24x7',
service_description => "${fqdn}_check_fail2ban",
target => $fn_target_service,
owner => 'nagios',
group => 'nagios',
mode => '0640',
contacts => $fn_target_contacts,
}
}
}

View File

@@ -100,6 +100,12 @@
# (uses action.d/badips.conf for reporting only). # (uses action.d/badips.conf for reporting only).
# @param [String] fn_default_action Choose default action. # @param [String] fn_default_action Choose default action.
# @param [String] fn_jail_paths the fail path. defaults to fedora. # @param [String] fn_jail_paths the fail path. defaults to fedora.
# @param [Boolean] fn_incl_target Whether to include monitoring targets for
# nagios. If set to true, monitoring targets will be included for the service.
# @param [String] fn_target_service The path to the nagios service configuration
# file to be created if fn_incl_target is set to true.
# @param [String] fn_target_contacts The nagios contacts to be notified for
# the service if fn_incl_target is set to true.
############################################################################### ###############################################################################
class confdroid_fail2ban::params ( class confdroid_fail2ban::params (
@@ -155,6 +161,11 @@ class confdroid_fail2ban::params (
String $fn_default_action = 'action_', String $fn_default_action = 'action_',
String $fn_jail_paths = 'fedora', String $fn_jail_paths = 'fedora',
# nagios
Boolean $fn_incl_target = false,
String $fn_target_service = '/etc/nagios/conf.d/fail2ban_service.cfg',
String $fn_target_contacts = 'nagiosadmin',
) { ) {
# shortcuts # shortcuts
$fqdn = $facts['networking']['fqdn'] $fqdn = $facts['networking']['fqdn']