OP#407 initial commit with reset

This commit is contained in:
2026-02-02 23:38:50 +01:00
parent 9998e83e79
commit e35b61e131
115 changed files with 67 additions and 20933 deletions

View File

@@ -1,38 +0,0 @@
## cd_nagios::nagios::objects::add_contact.pp
# Module name: cd_nagios
# Author: Arne Teuke (arne_teuke@ConfDroid.com)
# @summary Define manages additional contacts known to NAGIOS through external
# Puppet rules, and populates /etc/nagios/conf.d/nagios_add_contact.cfg.
# @example
# cd_nagios::nagios::objects::add_contact { 'example_user':
# ng_contact_name => 'example_user',
# ng_contact_alias => 'Example User',
# ng_contact_groups => 'admins',
# ng_contact_email => 'example@example.net',
# }
# @param [string] ng_contact_name Specify the contact short name.
# @param [string] ng_contact_use which contact template to use
# @param [string] ng_contact_alias Specify the contact alias (long name).
# @param [string] ng_contact_email Specify the contact email address.
# @param [string] ng_contact_groups specify the contact group for the contact.
################################################################################
define cd_nagios::nagios::objects::add_contact (
Optional[String] $ng_contact_name = undef,
String $ng_contact_use = 'generic-contact',
Optional[String] $ng_contact_alias = undef,
Optional[String] $ng_contact_email = undef,
Optional[String] $ng_contact_groups = undef,
) {
$ng_nagios_server = $::cd_nagios::params::ng_nagios_server
$ng_target_add_contact = $::cd_nagios::params::ng_target_add_contact
$ng_contacts_rule_erb = $::cd_nagios::params::ng_contacts_rule_erb
if $::fqdn == $ng_nagios_server {
concat::fragment { $name:
target => $ng_target_add_contact,
content => template($ng_contacts_rule_erb),
}
}
}

View File

@@ -1,40 +0,0 @@
## cd_nagios::nagios::objects::add_contact_rules.pp
# Module name: cd_nagios
# Author: Arne Teuke (arne_teuke@ConfDroid.com)
# @summary Class manages /etc/nagios/conf.d/nagios_add_contact.cfg through
# concat.
# @example cd_nagios::nagios::objects::add_contact { 'example_user':
# ng_contact_name => 'example_user',
# ng_contact_alias => 'Example User',
# ng_contact_groups => 'admins',
# ng_contact_email => 'example@example.net',
# }
################################################################################
class cd_nagios::nagios::objects::add_contact_rules (
) inherits cd_nagios::params {
if $::fqdn == $ng_nagios_server {
# manage /etc/nagios/conf.d/nagios_add_contacts.cfg
concat { $ng_target_add_contact:
ensure => present,
path => $ng_target_add_contact,
owner => $ng_user,
group => $ng_user,
mode => '0640',
selrange => s0,
selrole => object_r,
seltype => nagios_etc_t,
seluser => system_u,
notify => Service[$ng_service],
}
# manage file header
concat::fragment { 'contact_header':
target => $ng_target_add_contact,
content => template($ng_contacts_head_erb),
order => '000',
}
}
}

View File

@@ -1,30 +0,0 @@
## cd_nagios::nagios::objects::add_contactgroups.pp
# Module name: cd_nagios
# Author: Arne Teuke (arne_teuke@ConfDroid.com)
# @summary Define populates /etc/nagios/conf.d/nagios_add_contactgroups through
# external puppet rules.
# @param [string] ng_contactgroup_name Specify the short name of the
# contact group.
# @param [string] ng_contactgroup_alias Specify the alias (long name) of the
# contact group
# @param [string] ng_contactgroup_register Specify whether the contact group
# should be registered in Nagios.
################################################################################
define cd_nagios::nagios::objects::add_contactgroups (
Optional[String] $ng_contactgroup_name = undef,
Optional[String] $ng_contactgroup_alias = undef,
String $ng_contactgroup_register = '1',
) {
$ng_nagios_server = $cd_nagios::params::ng_nagios_server
$ng_tgt_contactgroup_add = $cd_nagios::params::ng_tgt_contactgroup_add
$ng_cntctgrps_rule_erb = $cd_nagios::params::ng_cntctgrps_rule_erb
if $::fqdn == $ng_nagios_server {
concat::fragment { $name:
target => $ng_tgt_contactgroup_add,
content => template($ng_cntctgrps_rule_erb),
}
}
}

View File

@@ -1,40 +0,0 @@
## cd_nagios::nagios::objects::add_contactgroups_rules.pp
# Module name: cd_nagios
# Author: Arne Teuke (arne_teuke@ConfDroid.com)
# @summary Class manages /etc/nagios/conf.d/nagios_add_contactgroups.cfg file
# and populates through define and external puppet rules
# @example
# cd_nagios::nagios::objects::add_contactgroups { 'example_group':
# ng_contactgroup_name => 'example_group',
# ng_contactgroup_alias => 'Example Group',
# ng_contactgroup_register => '1',
# }
################################################################################
class cd_nagios::nagios::objects::add_contactgroups_rules (
) inherits cd_nagios::params {
if $::fqdn == $ng_nagios_server {
# manage /etc/nagios/conf.d/nagios_add_contactgroups.cfg
concat { $ng_tgt_contactgroup_add:
ensure => present,
path => $ng_tgt_contactgroup_add,
owner => $ng_user,
group => $ng_user,
mode => '0640',
selrange => s0,
selrole => object_r,
seltype => nagios_etc_t,
seluser => system_u,
notify => Service[$ng_service],
}
# manage file header
concat::fragment { 'contactgroups_header':
target => $ng_tgt_contactgroup_add,
content => template($ng_cntctgrps_head_erb),
order => '000',
}
}
}

View File

@@ -1,39 +0,0 @@
## cd_nagios::nagios::objects::add_hostgroup_rules.pp
# Module name: cd_nagios
# Author: Arne Teuke (arne_teuke@ConfDroid.com)
# @summary Class manages /etc/nagios_conf.d/nagios_hostgroups_add.cfg and
# additional hostgroups through external Puppet rules via define.
# @example
# cd_nagios::nagios::objects::add_hostgroups { 'example_hostgroup':
# ng_hostgroup_name => 'example_hostgroup',
# ng_hostgroup_alias => 'Example Hostgroup',
# }
################################################################################
class cd_nagios::nagios::objects::add_hostgroup_rules (
) inherits cd_nagios::params {
if $::fqdn == $ng_nagios_server {
# manage /etc/nagios_conf.d/nagios_hostgroups_add.cfg
concat { $ng_tgt_hostgroup_add:
ensure => present,
path => $ng_tgt_hostgroup_add,
owner => $ng_user,
group => $ng_user,
mode => '0640',
selrange => s0,
selrole => object_r,
seltype => nagios_etc_t,
seluser => system_u,
notify => Service[$ng_service],
}
# manage file header
concat::fragment { 'hostgroups_header':
target => $ng_tgt_hostgroup_add,
content => template($ng_tgt_hostgrp_head_erb),
order => '000',
}
}
}

View File

@@ -1,32 +0,0 @@
## cd_nagios::nagios::objects::add_hostgroups.pp
# Module name: cd_nagios
# Author: Arne Teuke (arne_teuke@ConfDroid.com)
# @summary define populates /etc/nagios/conf.d/nagios_hostgroups_add through
# external Puppet rules.
# @example
# cd_nagios::nagios::objects::add_hostgroups { 'example_hostgroup':
# ng_hostgroup_name => 'example_hostgroup',
# ng_hostgroup_alias => 'Example Hostgroup',
# }
# @param [string] ng_hostgroup_name Specify the hostgroup short name.
# @param [string] ng_hostgroup_alias Specify the hostgroup alias (long name).
# @param [string] ng_hostgroup_register Whether to register the hostgroup.
###############################################################################
define cd_nagios::nagios::objects::add_hostgroups (
Optional[String] $ng_hostgroup_name = undef,
Optional[String] $ng_hostgroup_alias = undef,
String $ng_hostgroup_register = '1',
) {
$ng_nagios_server = $cd_nagios::params::ng_nagios_server
$ng_tgt_hostgroup_add = $cd_nagios::params::ng_tgt_hostgroup_add
$ng_tgt_hostgrp_rule_erb = $cd_nagios::params::ng_tgt_hostgrp_rule_erb
if $::fqdn == $ng_nagios_server {
concat::fragment { $name:
target => $ng_tgt_hostgroup_add,
content => template($ng_tgt_hostgrp_rule_erb),
}
}
}

View File

@@ -1,39 +0,0 @@
## cd_nagios::nagios::objects::add_servicegroup_rules.pp
# Module name: cd_nagios
# Author: Arne Teuke (arne_teuke@ConfDroid.com)
# @summary Class manages /etc/nagios_conf.d/nagios_servicegroups_add.cfg and
# additional servicegroups through external Puppet rules via define.
# @example
# cd_nagios::nagios::objects::add_servicegroups { 'example_servicegroup':
# ng_servicegroup_name => 'example_servicegroup',
# ng_servicegroup_alias => 'Example Servicegroup',
# }
################################################################################
class cd_nagios::nagios::objects::add_servicegroup_rules (
) inherits cd_nagios::params {
if $::fqdn == $ng_nagios_server {
# manage /etc/nagios_conf.d/nagios_servicegroups_add.cfg
concat { $ng_tgt_servicegroup_add:
ensure => present,
path => $ng_tgt_servicegroup_add,
owner => $ng_user,
group => $ng_user,
mode => '0640',
selrange => s0,
selrole => object_r,
seltype => nagios_etc_t,
seluser => system_u,
notify => Service[$ng_service],
}
# manage file header
concat::fragment { 'servicegroups_header':
target => $ng_tgt_servicegroup_add,
content => template($ng_tgt_svcgrp_head_erb),
order => '000',
}
}
}

View File

@@ -1,35 +0,0 @@
## cd_nagios::nagios::objects::add_servicegroups.pp
# Module name: cd_nagios
# Author: Arne Teuke (arne_teuke@ConfDroid.com)
# # License:
# @summary define populates /etc/nagios/conf.d/nagios_servicegroups_add through
# external Puppet rules.
# @example
# cd_nagios::nagios::objects::add_servicegroups { 'example_servicegroup':
# ng_servicegroup_name => 'example_servicegroup',
# ng_servicegroup_alias => 'Example servicegroup',
# }
# @param [string] ng_servicegroup_name Specify the servicegroup short name
# @param [string] ng_servicegroup_alias Specify the servicegroup alias
# (long name).
# @param [string] ng_servicegroup_register Whether you want to register the
# servicegroup
###############################################################################
define cd_nagios::nagios::objects::add_servicegroups (
Optional[String] $ng_servicegroup_name = undef,
Optional[String] $ng_servicegroup_alias = undef,
String $ng_servicegroup_register = '1',
) {
$ng_nagios_server = $cd_nagios::params::ng_nagios_server
$ng_tgt_servicegroup_add = $cd_nagios::params::ng_tgt_servicegroup_add
$ng_tgt_svcgrp_rule_erb = $cd_nagios::params::ng_tgt_svcgrp_rule_erb
if $::fqdn == $ng_nagios_server {
concat::fragment { $name:
target => $ng_tgt_servicegroup_add,
content => template($ng_tgt_svcgrp_rule_erb),
}
}
}

View File

@@ -1,45 +0,0 @@
# cd_nagios::nagios::objects::add_timeperiod_rules.pp
# Module name: cd_nagios
# Author: Arne Teuke (arne_teuke@ConfDroid.com)
# @summary Class manages /etc/nagios_conf.d/nagios_timeperiods_add.cfg and
# add. hostgroups through external Puppet rules via define.
# @example cd_nagios::nagios::objects::add_timeperiods { 'example_timeperiod':
# ng_timep_name => 'example_timeperiod',
# ng_timep_alias => 'Example timeperiod',
# ng_timep_monday => '00:00-00:00',
# ng_timep_tuesday => '00:00-00:00',
# ng_timep_wednesday => '00:00-00:00',
# ng_timep_thursday => '00:00-00:00',
# ng_timep_friday => '00:00-00:00',
# ng_timep_saturday => '00:00-00:00',
# ng_timep_sunday => '00:00-00:00',
# }
################################################################################
class cd_nagios::nagios::objects::add_timeperiod_rules (
) inherits cd_nagios::params {
if $::fqdn == $ng_nagios_server {
# manage /etc/nagios/conf.d/nagios_timeperiods_add.cfg
concat { $ng_tgt_timep_add:
ensure => present,
path => $ng_tgt_timep_add,
owner => $ng_user,
group => $ng_user,
mode => '0640',
selrange => s0,
selrole => object_r,
seltype => nagios_etc_t,
seluser => system_u,
notify => Service[$ng_service],
}
# manage file header
concat::fragment { 'timeperiods_header':
target => $ng_tgt_timep_add,
content => template($ng_tgt_timep_head_erb),
order => '000',
}
}
}

View File

@@ -1,51 +0,0 @@
## cd_nagios::nagios::objects::add_timeperiods.pp
# Module name: cd_nagios
# Author: Arne Teuke (arne_teuke@ConfDroid.com)
# @summary define populates /etc/nagios/conf.d/nagios_timeperiods_add through
# extermal Puppet rules.
# @example
# cd_nagios::nagios::objects::add_timeperiods { 'example_timeperiod':
# ng_timeperiod_name => 'example_timeperiod',
# ng_timeperiod_alias => 'Example timeperiod',
# ng_timep_monday => '00:00-00:00',
# ng_timep_tuesday => '00:00-00:00',
# ng_timep_wednesday => '00:00-00:00',
# ng_timep_thursday => '00:00-00:00',
# ng_timep_friday => '00:00-00:00',
# ng_timep_saturday => '00:00-00:00',
# ng_timep_sunday => '00:00-00:00',
# }
# @param [string] ng_timep_name Specify the timeperiod short name.
# @param [string] ng_timep_alias Specify the timeperiod alias (long name)
# @param [string] ng_timep_monday Specify the desired hours for Monday
# @param [string] ng_timep_tuesday Specify the desired hours for Tuesday
# @param [string] ng_timep_wednesday Specify the desired hours for Wednesday.
# @param [string] ng_timep_thursday Specify the desired hours for Thursday
# @param [string] ng_timep_friday Specify the desired hours for Friday
# @param [string] ng_timep_saturday Specify the desired hours for Saturday
# @param [string] ng_timep_sunday Specify the desired hours for Sunday.
###############################################################################
define cd_nagios::nagios::objects::add_timeperiods (
Optional[String] $ng_timep_name = undef,
Optional[String] $ng_timep_alias = undef,
String $ng_timep_monday = '00:00-00:00',
String $ng_timep_tuesday = '00:00-00:00',
String $ng_timep_wednesday = '00:00-00:00',
String $ng_timep_thursday = '00:00-00:00',
String $ng_timep_friday = '00:00-00:00',
String $ng_timep_saturday = '00:00-00:00',
String $ng_timep_sunday = '00:00-00:00',
) {
$ng_nagios_server = $cd_nagios::params::ng_nagios_server
$ng_tgt_timep_add = $cd_nagios::params::ng_tgt_timep_add
$ng_tgt_timep_rule_erb = $cd_nagios::params::ng_tgt_timep_rule_erb
if $::fqdn == $ng_nagios_server {
concat::fragment { $name:
target => $ng_tgt_timep_add,
content => template($ng_tgt_timep_rule_erb),
}
}
}

View File

@@ -1,222 +0,0 @@
## cd_nagios::nagios::objects::commands.pp
# Module name: cd_nagios
# Author: Arne Teuke (arne_teuke@ConfDroid.com)
# @summary Class manages all commands known to NAGIOS through Puppet exports,
# and populates /etc/nagios/conf.d/nagios_commands.cfg.
################################################################################
class cd_nagios::nagios::objects::commands (
) inherits cd_nagios::params {
if $::fqdn == $ng_nagios_server {
@@nagios_command { 'notify-host-by-email':
ensure => present,
command_name => 'notify-host-by-email',
command_line => '/usr/bin/printf "%b" "***** Nagios *****\n\nNotification Type: $NOTIFICATIONTYPE$\nHost: $HOSTADDRESS$\nState: $HOSTSTATE$\nAddress: $HOSTADDRESS$\nInfo: $HOSTOUTPUT$\n\nDate/Time: $LONGDATETIME$\n" | /bin/mail -s "** $NOTIFICATIONTYPE$ Host Alert: $HOSTADDRESS$ is $HOSTSTATE$ **" $CONTACTEMAIL$',
owner => 'nagios',
group => 'nagios',
mode => '0640',
target => $ng_target_command,
}
@@nagios_command { 'notify-service-by-email':
ensure => present,
command_name => 'notify-service-by-email',
command_line => '/usr/bin/printf "%b" "***** Nagios *****\n\nNotification Type: $NOTIFICATIONTYPE$\n\nService: $SERVICEDESC$\nHost: $HOSTALIAS$\nAddress: $HOSTADDRESS$\nState: $SERVICESTATE$\n\nDate/Time: $LONGDATETIME$\n\nAdditional Info:\n\n$SERVICEOUTPUT$\n" | /bin/mail -s "** $NOTIFICATIONTYPE$ Service Alert: $HOSTALIAS$/$SERVICEDESC$ is $SERVICESTATE$ **" $CONTACTEMAIL$',
owner => 'nagios',
group => 'nagios',
mode => '0640',
target => $ng_target_command,
}
@@nagios_command { 'check-host-alive':
ensure => present,
command_name => 'check-host-alive',
command_line => '$USER1$/check_ping -H $HOSTADDRESS$ -w 3000.0,80% -c 5000.0,100% -p 5',
owner => 'nagios',
group => 'nagios',
mode => '0640',
target => $ng_target_command,
}
@@nagios_command { 'check_disk':
ensure => present,
command_name => 'check_disk',
command_line => '$USER1$/check_disk -w $ARG1$ -c $ARG2$ -p $ARG3$',
owner => 'nagios',
group => 'nagios',
mode => '0640',
target => $ng_target_command,
}
@@nagios_command { 'check_local_load':
ensure => present,
command_name => 'check_local_load',
command_line => '$USER1$/check_load -w $ARG1$ -c $ARG2$',
owner => 'nagios',
group => 'nagios',
mode => '0640',
target => $ng_target_command,
}
@@nagios_command { 'check_local_procs':
ensure => present,
command_name => 'check_local_procs',
command_line => '$USER1$/check_procs -w $ARG1$ -c $ARG2$ -s $ARG3$',
owner => 'nagios',
group => 'nagios',
mode => '0640',
target => $ng_target_command,
}
@@nagios_command { 'check_local_users':
ensure => present,
command_name => 'check_local_users',
command_line => '$USER1$/check_users -w $ARG1$ -c $ARG2$',
owner => 'nagios',
group => 'nagios',
mode => '0640',
target => $ng_target_command,
}
@@nagios_command { 'check_local_swap':
ensure => present,
command_name => 'check_local_swap',
command_line => '$USER1$/check_swap -w $ARG1$ -c $ARG2$',
owner => 'nagios',
group => 'nagios',
mode => '0640',
target => $ng_target_command,
}
@@nagios_command { 'check_ftp':
ensure => present,
command_name => 'check_ftp',
command_line => '$USER1$/check_ftp -H $HOSTADDRESS$ $ARG1$',
owner => 'nagios',
group => 'nagios',
mode => '0640',
target => $ng_target_command,
}
@@nagios_command { 'check_snmp':
ensure => present,
command_name => 'check_snmp',
command_line => '$USER1$/check_snmp -H $HOSTADDRESS$ $ARG1$',
owner => 'nagios',
group => 'nagios',
mode => '0640',
target => $ng_target_command,
}
@@nagios_command { 'check_http':
ensure => present,
command_name => 'check_http',
command_line => '$USER1$/check_http -I $HOSTADDRESS$ $ARG1$',
owner => 'nagios',
group => 'nagios',
mode => '0640',
target => $ng_target_command,
}
@@nagios_command { 'check_ssh':
ensure => present,
command_name => 'check_ssh',
command_line => '$USER1$/check_ssh $ARG1$ $HOSTADDRESS$',
owner => 'nagios',
group => 'nagios',
mode => '0640',
target => $ng_target_command,
}
@@nagios_command { 'check_ping':
ensure => present,
command_name => 'check_ping',
command_line => '$USER1$/check_ping -H $HOSTADDRESS$ -w $ARG1$ -c $ARG2$ -p 5',
owner => 'nagios',
group => 'nagios',
mode => '0640',
target => $ng_target_command,
}
@@nagios_command { 'check_tcp':
ensure => present,
command_name => 'check_tcp',
command_line => '$USER1$/check_tcp -H $HOSTADDRESS$ -p $ARG1$ $ARG2$',
owner => 'nagios',
group => 'nagios',
mode => '0640',
target => $ng_target_command,
}
@@nagios_command { 'check_udp':
ensure => present,
command_name => 'check_udp',
command_line => '$USER1$/check_udp -H $HOSTADDRESS$ -p $ARG1$ $ARG2$',
owner => 'nagios',
group => 'nagios',
mode => '0640',
target => $ng_target_command,
}
@@nagios_command { 'check_nrpe':
ensure => present,
command_name => 'check_nrpe',
command_line => '$USER1$/check_nrpe -t 30 -H $HOSTADDRESS$ -c $ARG1$ -a $ARG2$ $ARG3$ $ARG4$',
owner => 'nagios',
group => 'nagios',
mode => '0640',
target => $ng_target_command,
}
@@nagios_command { 'check_nagios':
ensure => present,
command_name => 'check_nagios',
command_line => '$USER1$/check_nagios -F $ARG1$ -e $ARG2$ -C $ARG3$',
owner => 'nagios',
group => 'nagios',
mode => '0640',
target => $ng_target_command,
}
@@nagios_command { 'check_bandwidth':
ensure => present,
command_name => 'check_bandwidth',
command_line => '$USER1$/check_bandwidth.sh -t 30 -H $HOSTADDRESS$ linux $ARG1$ $ARG2$ $ARG3$',
owner => 'nagios',
group => 'nagios',
mode => '0640',
target => $ng_target_command,
}
@@nagios_command { 'process-service-perfdata-file':
ensure => present,
command_name => 'process-service-perfdata-file',
command_line => '/bin/mv /var/log/pnp4nagios/service-perfdata /var/spool/pnp4nagios/service-perfdata.$TIMET$',
owner => 'nagios',
group => 'nagios',
mode => '0640',
target => $ng_target_command,
}
@@nagios_command { 'process-host-perfdata-file':
ensure => present,
command_name => 'process-host-perfdata-file',
command_line => '/bin/mv /var/log/pnp4nagios/host-perfdata /var/spool/pnp4nagios/host-perfdata.$TIMET$',
owner => 'nagios',
group => 'nagios',
mode => '0640',
target => $ng_target_command,
}
@@nagios_command { 'check_ntp_time':
ensure => present,
command_name => 'check_ntp_time',
command_line => '$USER1$/check_ntp_time -H $HOSTADDRESS$ -w $ARG1$ -c $ARG2$',
owner => 'nagios',
group => 'nagios',
mode => '0640',
target => $ng_target_command,
}
}
}

View File

@@ -1,24 +0,0 @@
## cd_nagios::server::nagios::objects::config.pp
# Module name: cd_nagios
# Author: Arne Teuke (arne_teuke@ConfDroid.com)
# @summary Class manages the nagios objects definitions.
#############################################################################
class cd_nagios::nagios::objects::config (
) inherits cd_nagios::params {
if $::fqdn == $ng_nagios_server {
require cd_nagios::nagios::objects::commands
require cd_nagios::nagios::objects::template_rules
require cd_nagios::nagios::objects::contacts
require cd_nagios::nagios::objects::add_contact_rules
require cd_nagios::nagios::objects::contactgroups
require cd_nagios::nagios::objects::add_contactgroups_rules
require cd_nagios::nagios::objects::hostgroups
require cd_nagios::nagios::objects::add_hostgroup_rules
require cd_nagios::nagios::objects::servicegroups
require cd_nagios::nagios::objects::add_servicegroup_rules
require cd_nagios::nagios::objects::timeperiods
require cd_nagios::nagios::objects::add_timeperiod_rules
}
}

View File

@@ -1,54 +0,0 @@
## cd_nagios::nagios::objects::contactgroups.pp
# Module name: cd_nagios
# Author: Arne Teuke (arne_teuke@ConfDroid.com)
# @summary Class manages base contactgroups which always should be there.
# @example
# @@nagios_contactgroup { 'admins':
# ensure => present,
# alias => 'Nagios Administrators',
# contactgroup_name => 'admins',
# owner => $ng_user,
# group => $ng_user,
# mode => '0640',
# register => '1',
# target => $ng_tgt_contactgroup_base,
# }
################################################################################
class cd_nagios::nagios::objects::contactgroups (
) inherits cd_nagios::params {
if $::fqdn == $ng_nagios_server {
@@nagios_contactgroup { 'admins':
ensure => present,
alias => 'Nagios Administrators',
contactgroup_name => 'admins',
owner => $ng_user,
group => $ng_user,
mode => '0640',
register => '1',
target => $ng_tgt_contactgroup_base,
}
@@nagios_contactgroup { 'operations':
ensure => present,
alias => 'Operations Team',
contactgroup_name => 'operations',
owner => $ng_user,
group => $ng_user,
mode => '0640',
register => '1',
target => $ng_tgt_contactgroup_base,
}
@@nagios_contactgroup { 'support':
ensure => present,
alias => 'Support Team',
contactgroup_name => 'support',
owner => $ng_user,
group => $ng_user,
mode => '0640',
register => '1',
target => $ng_tgt_contactgroup_base,
}
}
}

View File

@@ -1,80 +0,0 @@
## cd_nagios::nagios::objects::contacts.pp
# Module name: cd_nagios
# Author: Arne Teuke (arne_teuke@ConfDroid.com)
# @summary Class manages basic contacts known to NAGIOS through Puppet exports,
# and populates /etc/nagios/conf.d/nagios_base_contacts.cfg.
# @example
# @@nagios_contact { 'admin':
# ensure => present,
# alias => 'Nagios Admin',
# contact_name => 'admin',
# contactgroups => 'admins',
# email => "admin@${::domain}",
# can_submit_commands => '1',
# register => '1',
# use => 'generic-contact',
# target => $ng_target_base_contact,
# owner => 'root',
# group => 'nagios',
# mode => '0664',
# }
################################################################################
class cd_nagios::nagios::objects::contacts (
) inherits cd_nagios::params {
if $::fqdn == $ng_nagios_server {
# admin contact
@@nagios_contact { 'admin':
ensure => present,
alias => 'Nagios Admin',
contact_name => 'admin',
contactgroups => 'admins',
email => "admin@${::domain}",
can_submit_commands => '1',
register => '1',
use => 'generic-contact',
target => $ng_target_base_contact,
owner => $ng_user,
group => $ng_user,
mode => '0640',
}
# ops contact
@@nagios_contact { 'ops':
ensure => present,
alias => 'Operations',
contact_name => 'ops',
contactgroups => 'operations',
email => "ops@${::domain}",
can_submit_commands => '1',
register => '1',
use => 'generic-contact',
target => $ng_target_base_contact,
owner => $ng_user,
group => $ng_user,
mode => '0640',
}
# support contact
@@nagios_contact { 'support':
ensure => present,
alias => 'support',
contact_name => 'support',
contactgroups => 'support',
email => "support@${::domain}",
can_submit_commands => '1',
register => '1',
use => 'generic-contact',
target => $ng_target_base_contact,
owner => $ng_user,
group => $ng_user,
mode => '0640',
}
}
}

View File

@@ -1,208 +0,0 @@
## cd_nagios::nagios::objects::hostgroups.pp
# Module name: cd_nagios
# Author: Arne Teuke (arne_teuke@ConfDroid.com)
# @summary Class manages basic hostgroups known to NAGIOS through Puppet
# exports, and populates /etc/nagios/conf.d/nagios_base_hostgroups.cfg.
################################################################################
class cd_nagios::nagios::objects::hostgroups (
) inherits cd_nagios::params {
if $::fqdn == $ng_nagios_server {
# linux servers
@@nagios_hostgroup { 'linux-servers':
ensure => present,
hostgroup_name => 'linux-servers',
alias => 'Linux Servers',
owner => $ng_user,
group => $ng_user,
mode => '0640',
register => '1',
target => $ng_target_hostgroup_base,
}
# RHEL servers
@@nagios_hostgroup { 'rhel-servers':
ensure => present,
hostgroup_name => 'rhel-servers',
alias => 'RHEL Servers',
owner => $ng_user,
group => $ng_user,
mode => '0640',
register => '1',
target => $ng_target_hostgroup_base,
}
# CentOS servers
@@nagios_hostgroup { 'centos-servers':
ensure => present,
hostgroup_name => 'centos-servers',
alias => 'CentOS Servers',
owner => $ng_user,
group => $ng_user,
mode => '0640',
register => '1',
target => $ng_target_hostgroup_base,
}
# SuSE servers
@@nagios_hostgroup { 'suse-servers':
ensure => present,
hostgroup_name => 'suse-servers',
alias => 'SuSE Servers',
owner => $ng_user,
group => $ng_user,
mode => '0640',
register => '1',
target => $ng_target_hostgroup_base,
}
# Unix servers
@@nagios_hostgroup { 'unix-servers':
ensure => present,
hostgroup_name => 'unix-servers',
alias => 'Unix Servers',
owner => $ng_user,
group => $ng_user,
mode => '0640',
register => '1',
target => $ng_target_hostgroup_base,
}
# Solaris servers
@@nagios_hostgroup { 'solaris-servers':
ensure => present,
hostgroup_name => 'solaris-servers',
alias => 'Solaris Servers',
owner => $ng_user,
group => $ng_user,
mode => '0640',
register => '1',
target => $ng_target_hostgroup_base,
}
# AIX servers
@@nagios_hostgroup { 'aix-servers':
ensure => present,
hostgroup_name => 'aix-servers',
alias => 'AIX Servers',
owner => $ng_user,
group => $ng_user,
mode => '0640',
register => '1',
target => $ng_target_hostgroup_base,
}
# Windows servers
@@nagios_hostgroup { 'windows-servers':
ensure => present,
hostgroup_name => 'windows-servers',
alias => 'Windows Servers',
owner => $ng_user,
group => $ng_user,
mode => '0640',
register => '1',
target => $ng_target_hostgroup_base,
}
# Netware servers
@@nagios_hostgroup { 'netware-servers':
ensure => present,
hostgroup_name => 'netware-servers',
alias => 'Netware Servers',
owner => $ng_user,
group => $ng_user,
mode => '0640',
register => '1',
target => $ng_target_hostgroup_base,
}
# DB servers
@@nagios_hostgroup { 'db-servers':
ensure => present,
hostgroup_name => 'db-servers',
alias => 'DB Servers',
owner => $ng_user,
group => $ng_user,
mode => '0640',
register => '1',
target => $ng_target_hostgroup_base,
}
# Oracle servers
@@nagios_hostgroup { 'oracle-servers':
ensure => present,
hostgroup_name => 'oracle-servers',
alias => 'Oracle Servers',
owner => $ng_user,
group => $ng_user,
mode => '0640',
register => '1',
target => $ng_target_hostgroup_base,
}
# MySQL servers
@@nagios_hostgroup { 'mysql-servers':
ensure => present,
hostgroup_name => 'mysql-servers',
alias => 'MySQL Servers',
owner => $ng_user,
group => $ng_user,
mode => '0640',
register => '1',
target => $ng_target_hostgroup_base,
}
# MSSQL servers
@@nagios_hostgroup { 'mssql-servers':
ensure => present,
hostgroup_name => 'mssql-servers',
alias => 'MSSQL Servers',
owner => $ng_user,
group => $ng_user,
mode => '0640',
register => '1',
target => $ng_target_hostgroup_base,
}
# NOSQL servers
@@nagios_hostgroup { 'nosql-servers':
ensure => present,
hostgroup_name => 'nosql-servers',
alias => 'NOSQL Servers',
owner => $ng_user,
group => $ng_user,
mode => '0640',
register => '1',
target => $ng_target_hostgroup_base,
}
# Hadoop servers
@@nagios_hostgroup { 'hadoop-servers':
ensure => present,
hostgroup_name => 'hadoop-servers',
alias => 'HADOOP Servers',
owner => $ng_user,
group => $ng_user,
mode => '0640',
register => '1',
target => $ng_target_hostgroup_base,
}
}
}

View File

@@ -1,50 +0,0 @@
## cd_nagios::nagios::objects::servicegroups.pp
# Module name: cd_nagios
# Author: Arne Teuke (arne_teuke@ConfDroid.com)
# @summary Class manages basic hostgroups known to NAGIOS through Puppet
# exports, and populates /etc/nagios/conf.d/nagios_base_hostgroups.cfg.
################################################################################
class cd_nagios::nagios::objects::servicegroups (
) inherits cd_nagios::params {
if $::fqdn == $ng_nagios_server {
# network services
@@nagios_servicegroup { 'network-services':
ensure => present,
servicegroup_name => 'network-services',
alias => 'Network Services',
owner => $ng_user,
group => $ng_user,
mode => '0640',
register => '1',
target => $ng_target_svcgrp_base,
}
# linux services
@@nagios_servicegroup { 'linux-services':
ensure => present,
servicegroup_name => 'linux-services',
alias => 'Linux Services',
owner => $ng_user,
group => $ng_user,
mode => '0640',
register => '1',
target => $ng_target_svcgrp_base,
}
# database services
@@nagios_servicegroup { 'database-services':
ensure => present,
servicegroup_name => 'database-services',
alias => 'Database Services',
owner => $ng_user,
group => $ng_user,
mode => '0640',
register => '1',
target => $ng_target_svcgrp_base,
}
}
}

View File

@@ -1,82 +0,0 @@
## cd_nagios::nagios::objects::template_rules.pp
# Module name: cd_nagios
# Author: Arne Teuke (arne_teuke@ConfDroid.com)
# @summary Class manages /etc/nagios/conf.d/nagios_templates.cfg through
# concat.
# @example cd_nagios::nagios::objects::templates { 'generic contact':
# ng_template_object => 'contact',
# ng_template_object_name => 'generic-contact',
# }
################################################################################
class cd_nagios::nagios::objects::template_rules (
) inherits cd_nagios::params {
if $::fqdn == $ng_nagios_server {
# create the templates.cfg file
concat { $ng_target_templates:
ensure => present,
path => $ng_target_templates,
owner => $ng_user,
group => $ng_user,
mode => '0640',
selrange => s0,
selrole => object_r,
seltype => nagios_etc_t,
seluser => system_u,
notify => Service[$ng_service],
}
concat::fragment { 'template_header':
target => $ng_target_templates,
content => template($ng_templates_head_erb),
order => '000',
}
# basic templates
cd_nagios::nagios::objects::templates { 'generic contact':
ng_template_object => 'contact',
ng_template_object_name => 'generic-contact',
}
cd_nagios::nagios::objects::templates { 'generic-host':
ng_template_object => 'host',
ng_template_object_name => 'generic-host',
}
cd_nagios::nagios::objects::templates { 'linux-server':
ng_template_object => 'host',
ng_template_object_name => 'linux-server',
ng_template_object_use => 'generic-host',
ng_notification_options => 'd,u,r',
}
cd_nagios::nagios::objects::templates { 'windows-server':
ng_template_object => 'host',
ng_template_object_name => 'windows-server',
ng_template_object_use => 'generic-host',
ng_notification_options => 'd,u,r',
}
cd_nagios::nagios::objects::templates { 'generic-switch':
ng_template_object => 'host',
ng_template_object_name => 'generic-switch',
ng_template_object_use => 'generic-host',
ng_notification_options => 'd,u,r',
}
cd_nagios::nagios::objects::templates { 'generic-printer':
ng_template_object => 'host',
ng_template_object_name => 'generic-printer',
ng_template_object_use => 'generic-host',
ng_notification_options => 'd,u,r',
}
cd_nagios::nagios::objects::templates { 'generic-service':
ng_template_object => 'service',
ng_template_object_name => 'generic-service',
ng_max_check_attempts => '3',
ng_notification_options => 'w,u,c,r',
}
cd_nagios::nagios::objects::templates { 'local-service':
ng_template_object => 'service',
ng_template_object_name => 'local-service',
ng_max_check_attempts => '4',
ng_template_object_use => 'generic-service',
}
}
}

View File

@@ -1,123 +0,0 @@
## cd_nagios::nagios::objects::templates.pp
# Module name: cd_nagios
# Author: Arne Teuke (arne_teuke@ConfDroid.com)
# @summary Define manages populates /etc/nagios/conf.d/templates.cfg.
# @param [String] ng_template_object the object type for the templates.
# Valid options are `contact`, `host` and `service`.
# @param [String] ng_template_object_name populates the name field,
# i.e. `generic-contact`, `generic-host`, `generic-service`.
# @param [String] ng_svc_notification_period Period in which to send out
# notifications for service events, i.e. `24x7`.
# @param [String] ng_host_notification_period Period in which to send out
# notifications for host events , i.e. `24x7`.
# @param [String] ng_service_notification_options What service events to send
# out notifications for:
# w = notify on WARNING service states,
# u = notify on UNKNOWN service states,
# c = notify on CRITICAL service states,
# r = notify on service recoveries (OK states),
# f = notify when the service starts and stops flapping.
# n = none (the contact will not receive any type of service notifications).
# @param [String] ng_host_notification_options What host events to send
# out notifications for:
# d = notify on DOWN host states,
# u = notify on UNREACHABLE host states,
# r = notify on host recoveries (UP states),
# f = notify when the host starts and stops flapping,
# s = notify when host or service scheduled downtime starts and ends.
# n = none (the contact will not receive any type of host notifications).
# @param [String] ng_service_notification_commands Command to use for
# service event notification. Command must be defined in commands.cfg
# @param [String] ng_host_notification_commands Command to use for
# host event notification. Command must be defined in commands.cfg.
# @param [String] ng_object_register Whether to register the object to Nagios.
# Since this is a template definition, we do not want to register those.
# @param [String] ng_template_object_use Which template to use for a given
# host or service definition, i.e. `generic-host`, `generic-service` etc.
# @param [String] ng_notifications_enabled Whether notifications are enabled.
# Valid options are `0` and `1`.
# @param [String] ng_event_handler_enabled Whether event handlers are enabled.
# Valid options are `0` and `1`.
# @param [String] ng_flap_detection_enabled Whether flap detection is enabled.
# Valid options are `0` and `1`.
# @param [String] ng_process_perf_data Whether to process performance data.
# Valid options are `0` and `1`.
# @param [String] ng_retain_status_information Whether to retain status
# information. Valid options are `0` and `1`.
# @param [String] ng_retain_nonstatus_information Whether to retain non-status
# information. Valid options are `0` and `1`.
# @param [String] ng_notification_period Which period in to send out
# notifications. for the defined service or host.
# @param [String] ng_notification_interval how often (in minutes) we should
# resend notifications for the current status.
# @param [String] ng_check_period Which period in to run checks for the defined
# object.
# @param [String] ng_max_check_attempts how often to check the defined object
# maximal.
# @param [String] ng_notification_options see `ng_service_notification_options`
# and `ng_host_notification_options`.
# @param [String] ng_contact_groups contact groups for the defined object.
# Specified contact group must exit in contact_groups
# @param [String] ng_active_checks_enabled Whether to enable active checks.
# Valid options are `0` and `1`.
# @param [String] ng_passive_checks_enabled Whether to enable passive checks.
# Valid options are `0` and `1`.
# @param [String] ng_parallelize_check Whether to parallelize checks
# Valid options are `0` and `1`.
# @param [String] ng_obsess_over_service Whether to obsess over the service.
# Valid options are `0` and `1`.
# @param [String] ng_check_freshness Whether to check freshness.
# Valid options are `0` and `1`.
# @param [String] ng_is_volatile Whether the service is volatile.
# Valid options are `0` and `1`.
# @param [String] ng_check_interval How often to check the service
# under normal conditions.
# @param [String] ng_retry_interval Re-check the service every x minutes
# until a hard state can be determined.
# @param [String] ng_host_check_command the check command for host checks
################################################################################
define cd_nagios::nagios::objects::templates (
Optional[String] $ng_template_object = undef,
Optional[String] $ng_template_object_name = undef,
String $ng_svc_notification_period = '24x7',
String $ng_host_notification_period = '24x7',
String $ng_service_notification_options = 'w,u,c,r,f,s',
String $ng_host_notification_options = 'd,u,r,f,s',
String $ng_service_notification_commands = 'notify-service-by-email',
String $ng_host_notification_commands = 'notify-host-by-email',
String $ng_object_register = '0',
Optional[String] $ng_template_object_use = undef,
String $ng_notifications_enabled = '1',
String $ng_event_handler_enabled = '1',
String $ng_flap_detection_enabled = '1',
String $ng_process_perf_data = '1',
String $ng_retain_status_information = '1',
String $ng_retain_nonstatus_information = '1',
String $ng_notification_period = '24x7',
String $ng_notification_interval = '30',
String $ng_check_period = '24x7',
String $ng_check_interval = '5',
String $ng_retry_interval = '1',
String $ng_max_check_attempts = '10',
String $ng_host_check_command = 'check-host-alive',
Optional[String] $ng_notification_options = undef,
String $ng_contact_groups = 'admins',
String $ng_active_checks_enabled = '1',
String $ng_passive_checks_enabled = '1',
String $ng_parallelize_check = '1',
String $ng_obsess_over_service = '1',
String $ng_check_freshness = '0',
String $ng_is_volatile = '0',
) {
$ng_nagios_server = $cd_nagios::params::ng_nagios_server
$ng_target_templates = $cd_nagios::params::ng_target_templates
$ng_templates_rule_erb = $cd_nagios::params::ng_templates_rule_erb
if $::fqdn == $ng_nagios_server {
concat::fragment { $name:
target => $ng_target_templates,
content => template($ng_templates_rule_erb),
}
}
}

View File

@@ -1,76 +0,0 @@
# cd_nagios::nagios::objects::timeperiods.pp
# Module name: cd_nagios
# Author: Arne Teuke (arne_teuke@ConfDroid.com)
# @summary Class manages main timeperiods for NAGIOS through Puppet exports,
# and populates /etc/nagios/conf.d/nagios_timeperiods_base.cfg.
################################################################################
class cd_nagios::nagios::objects::timeperiods (
) inherits cd_nagios::params {
if $::fqdn == $ng_nagios_server {
@@nagios_timeperiod { '24x7':
ensure => present,
timeperiod_name => '24x7',
alias => '24 Hours A Day, 7 Days A Week',
monday => '00:00-24:00',
tuesday => '00:00-24:00',
wednesday => '00:00-24:00',
thursday => '00:00-24:00',
friday => '00:00-24:00',
saturday => '00:00-24:00',
sunday => '00:00-24:00',
owner => $ng_user,
group => $ng_user,
mode => '0640',
register => '1',
target => $ng_tgt_timeperiods_base,
}
@@nagios_timeperiod { 'office_hours':
ensure => present,
timeperiod_name => 'office_hours',
alias => 'Office hours only, 5 Days A Week 09-05',
monday => '09:00-17:00',
tuesday => '09:00-17:00',
wednesday => '09:00-17:00',
thursday => '09:00-17:00',
friday => '09:00-17:00',
saturday => '00:00-00:00',
sunday => '00:00-00:00',
owner => $ng_user,
group => $ng_user,
mode => '0640',
register => '1',
target => $ng_tgt_timeperiods_base,
}
@@nagios_timeperiod { 'out_of_hours':
ensure => present,
timeperiod_name => 'out_of_hours',
alias => 'Outside Office hours only',
monday => '17:00-09:00',
tuesday => '17:00-09:00',
wednesday => '17:00-09:00',
thursday => '17:00-09:00',
friday => '17:00-09:00',
saturday => '00:00-24:00',
sunday => '00:00-24:00',
owner => $ng_user,
group => $ng_user,
mode => '0640',
register => '1',
target => $ng_tgt_timeperiods_base,
}
@@nagios_timeperiod { 'none':
ensure => present,
timeperiod_name => 'none',
alias => 'No Time Is A Good Time',
owner => $ng_user,
group => $ng_user,
mode => '0640',
register => '1',
target => $ng_tgt_timeperiods_base,
}
}
}