adjusted all params etc

This commit is contained in:
Arne Teuke
2025-05-12 15:56:17 +02:00
parent bfa5f46e2f
commit 4ebbfed5ea
85 changed files with 1880 additions and 20534 deletions

View File

@@ -1,33 +1,14 @@
## cd_nagios::certbot::certs.pp
# Module name: cd_nagios
# Author: Arne Teuke (arne_teuke@ConfDroid.com)
# # License:
# This file is part of cd_nagios.
#
# cd_nagios is used for providing automatic configuration of Nagios
# Copyright (C) 2016 ConfDroid (copyright@ConfDroid.com)
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation, either version 3 of the License, or
# (at your option) any later version.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with this program. If not, see <http://www.gnu.org/licenses/>.
# @summary Class manages all configuration files required for cd_nagios.
##############################################################################
class cd_nagios::certbot::certs (
) inherits cd_nagios::params {
if $::fqdn == $ng_nagios_server {
if $ng_use_https == true {
if $ng_enable_certbot == true {
require cd_certbot
require cd_apache
@@ -38,24 +19,24 @@ class cd_nagios::certbot::certs (
# create cert
exec { 'create_cert':
command => template($ng_get_cert_erb),
cwd => '/tmp',
path => ['/bin','/usr/bin'],
provider => 'shell',
unless => template('cd_nagios/certbot/unless_get_cert.erb'),
notify => Service['httpd'],
creates => $ng_certbot_check,
command => template($ng_get_cert_erb),
cwd => '/tmp',
path => ['/bin','/usr/bin'],
provider => 'shell',
unless => template('cd_nagios/certbot/unless_get_cert.erb'),
notify => Service['httpd'],
creates => $ng_certbot_check,
}
# renew certs
exec { 'renew_cert':
command => 'certbot renew',
cwd => '/tmp',
path => ['/bin','/usr/bin','/opt/'],
provider => 'shell',
notify => Service['httpd'],
unless => template($ng_unless_renew_erb),
exec { 'renew_cert':
command => 'certbot renew',
cwd => '/tmp',
path => ['/bin','/usr/bin','/opt/'],
provider => 'shell',
notify => Service['httpd'],
unless => template($ng_unless_renew_erb),
}
}
}

View File

@@ -1,144 +1,123 @@
## cd_nagios::client::target.pp
# Module name: nagios
# Author: Arne Teuke (arne_teuke@ConfDroid.com)
# License:
# This file is part of nagios.
#
# nagios is used for providing automatic configuration of Nagios targets.
# Copyright (C) 2016 ConfDroid (copyright@ConfDroid.com)
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation, either version 3 of the License, or
# (at your option) any later version.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with this program. If not, see <http://www.gnu.org/licenses/>.
# @summary CLass manages Nagios targets for cd_nagios.
###############################################################################
class cd_nagios::client::target (
) inherits cd_nagios::params {
if $::fqdn != $ng_nagios_server {
if $ng_include_nrpe == true {
require cd_nagios::main::user
require cd_nrpe
require cd_nagios::main::user
require cd_nrpe
@@nagios_host { $::fqdn:
ensure => $ng_ping_ensure,
alias => $::hostname,
address => $::fqdn,
use => 'linux-server',
target => $ng_target_host,
hostgroups => 'linux-servers',
contacts => 'ops',
max_check_attempts => $ng_max_check_attempts,
notification_period => '24x7',
owner => $ng_user,
group => $ng_user,
mode => '0640',
check_command => "check_ping!${ng_ping_warn}!${ng_ping_crit}",
notify => Service[$ng_user],
ensure => $ng_ping_ensure,
alias => $::hostname,
address => $::fqdn,
use => 'linux-server',
target => $ng_target_host,
hostgroups => 'linux-servers',
contacts => 'ops',
max_check_attempts => $ng_max_check_attempts,
notification_period => '24x7',
owner => $ng_user,
group => $ng_user,
mode => '0640',
check_command => "check_ping!${ng_ping_warn}!${ng_ping_crit}",
notify => Service[$ng_user],
}
@@nagios_service { "root_partition_${::hostname}":
ensure => $ng_disk_ensure,
check_command => "check_nrpe!check_disk!${ng_disk_warn}!${ng_disk_crit}!/",
use => 'generic-service',
host_name => $::fqdn,
contacts => 'ops',
notification_period => '24x7',
service_description => "${::hostname}_root_partition",
servicegroups => 'linux-services',
target => $ng_target_service,
owner => $ng_user,
group => $ng_user,
mode => '0640',
ensure => $ng_disk_ensure,
check_command => "check_nrpe!check_disk!${ng_disk_warn}!${ng_disk_crit}!/",
use => 'generic-service',
host_name => $::fqdn,
contacts => 'ops',
notification_period => '24x7',
service_description => "${::hostname}_root_partition",
servicegroups => 'linux-services',
target => $ng_target_service,
owner => $ng_user,
group => $ng_user,
mode => '0640',
}
if $ng_enable_swap_check == true {
@@nagios_service { "Swap_Usage_${::hostname}":
ensure => $ng_swap_ensure,
check_command => "check_nrpe!check_swap!${ng_swap_warn}!${ng_swap_crit}",
use => 'generic-service',
host_name => $::fqdn,
contacts => 'ops',
notification_period => '24x7',
service_description => "${::hostname}_swap_usage",
servicegroups => 'linux-services',
target => $ng_target_service,
owner => $ng_user,
group => $ng_user,
mode => '0640',
@@nagios_service { "Swap_Usage_${::hostname}":
ensure => $ng_swap_ensure,
check_command => "check_nrpe!check_swap!${ng_swap_warn}!${ng_swap_crit}",
use => 'generic-service',
host_name => $::fqdn,
contacts => 'ops',
notification_period => '24x7',
service_description => "${::hostname}_swap_usage",
servicegroups => 'linux-services',
target => $ng_target_service,
owner => $ng_user,
group => $ng_user,
mode => '0640',
}
}
}
@@nagios_service { "Local_Users_${::hostname}":
ensure => $ng_users_ensure,
check_command => "check_nrpe!check_users!${ng_users_warn}!${ng_users_crit}",
use => 'generic-service',
host_name => $::fqdn,
contacts => 'ops',
notification_period => '24x7',
service_description => "${::hostname}_local_users",
servicegroups => 'linux-services',
target => $ng_target_service,
owner => $ng_user,
group => $ng_user,
mode => '0640',
ensure => $ng_users_ensure,
check_command => "check_nrpe!check_users!${ng_users_warn}!${ng_users_crit}",
use => 'generic-service',
host_name => $::fqdn,
contacts => 'ops',
notification_period => '24x7',
service_description => "${::hostname}_local_users",
servicegroups => 'linux-services',
target => $ng_target_service,
owner => $ng_user,
group => $ng_user,
mode => '0640',
}
@@nagios_service { "Total Processes_${::hostname}":
ensure => $ng_procs_tot_ens,
check_command => "check_nrpe!check_procs!${ng_procs_tot_warn}!${ng_procs_tot_crit}!${ng_procs_tot_param}",
use => 'generic-service',
host_name => $::fqdn,
contacts => 'ops',
notification_period => '24x7',
service_description => "${::hostname}_total_processes",
servicegroups => 'linux-services',
target => $ng_target_service,
owner => $ng_user,
group => $ng_user,
mode => '0640',
ensure => $ng_procs_tot_ens,
check_command => "check_nrpe!check_procs!${ng_procs_tot_warn}!${ng_procs_tot_crit}!${ng_procs_tot_param}",
use => 'generic-service',
host_name => $::fqdn,
contacts => 'ops',
notification_period => '24x7',
service_description => "${::hostname}_total_processes",
servicegroups => 'linux-services',
target => $ng_target_service,
owner => $ng_user,
group => $ng_user,
mode => '0640',
}
@@nagios_service { "Zombie Processes_${::hostname}":
ensure => $ng_procs_z_ensure,
check_command => "check_nrpe!check_procs!${ng_procs_z_warn}!${ng_procs_z_crit}!${ng_procs_z_param}",
use => 'generic-service',
host_name => $::fqdn,
contacts => 'ops',
notification_period => '24x7',
service_description => "${::hostname}_zombie_processes",
servicegroups => 'linux-services',
target => $ng_target_service,
owner => $ng_user,
group => $ng_user,
mode => '0640',
ensure => $ng_procs_z_ensure,
check_command => "check_nrpe!check_procs!${ng_procs_z_warn}!${ng_procs_z_crit}!${ng_procs_z_param}",
use => 'generic-service',
host_name => $::fqdn,
contacts => 'ops',
notification_period => '24x7',
service_description => "${::hostname}_zombie_processes",
servicegroups => 'linux-services',
target => $ng_target_service,
owner => $ng_user,
group => $ng_user,
mode => '0640',
}
@@nagios_service { "Current_Load_${::hostname}":
ensure => $ng_load_ensure,
check_command => "check_nrpe!check_load!${ng_load_warn}!${ng_load_crit}",
use => 'generic-service',
host_name => $::fqdn,
contacts => 'ops',
notification_period => '24x7',
service_description => "${::hostname}_current_load",
servicegroups => 'linux-services',
target => $ng_target_service,
owner => $ng_user,
group => $ng_user,
mode => '0640',
ensure => $ng_load_ensure,
check_command => "check_nrpe!check_load!${ng_load_warn}!${ng_load_crit}",
use => 'generic-service',
host_name => $::fqdn,
contacts => 'ops',
notification_period => '24x7',
service_description => "${::hostname}_current_load",
servicegroups => 'linux-services',
target => $ng_target_service,
owner => $ng_user,
group => $ng_user,
mode => '0640',
}
}
}

View File

@@ -1,43 +1,19 @@
## cd_nagios::firewall::iptables.pp
# Module name: cd_nagios
# Author: Arne Teuke (arne_teuke@ConfDroid.com)
# License:
# This file is part of cd_nagios.
#
# cd_nagios is used for providing automatic configuration of
# <service / purpose>
# Copyright (C) 2017 ConfDroid (copyright@ConfDroid.com)
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation, either version 3 of the License, or
# (at your option) any later version.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with this program. If not, see <http://www.gnu.org/licenses/>.
# @summary manage firewall settings through cd_firewall or puppetlabs-firewall
###############################################################################
class cd_nagios::firewall::iptables (
) inherits cd_nagios::params {
if $::fqdn == $ng_nagios_server {
if $ng_use_https != true {
include confdroid_infrastructure::firewall::http
if $ng_use_https == true {
include confdroid_infrastructure::firewall::https
if $ng_http_https_fw == true {
include confdroid_infrastructure::firewall::http
if $ng_use_https == true {
include confdroid_infrastructure::firewall::https
if $ng_http_https_fw == true {
include confdroid_infrastructure::firewall::http
}
}
}

View File

@@ -1,24 +1,7 @@
## cd_nagios::init.pp
# Module name: cd_nagios
# Author: Arne Teuke (arne_teuke@confdroid.com)
# License:
# This file is part of cd_nagios.
#
# cd_nagios is used for providing automatic configuration of Nagios
# Copyright (C) 2017 confdroid (copyright@confdroid.com)
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation, either version 3 of the License, or
# (at your option) any later version.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with this program. If not, see <http://www.gnu.org/licenses/>.
# @summary Class initialises the cd_nagios Module.
# @summary Class initializes the cd_nagios Module.
##############################################################################
class cd_nagios {
include cd_nagios::params

View File

@@ -1,30 +1,12 @@
## cd_nagios::main::config.pp
# Module name: cd_nagios
# Author: Arne Teuke (arne_teuke@ConfDroid.com)
# # License:
# This file is part of cd_nagios.
#
# cd_nagios is used for providing automatic configuration of Nagios
# Copyright (C) 2016 ConfDroid (copyright@ConfDroid.com)
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation, either version 3 of the License, or
# (at your option) any later version.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with this program. If not, see <http://www.gnu.org/licenses/>.
# @summary Class manages all aspects of configuring the module logic for
# cd_nagios.
##############################################################################
class cd_nagios::main::config (
) inherits cd_nagios::params {
# manage server configuration
if $::fqdn == $ng_nagios_server {

View File

@@ -1,228 +1,208 @@
## cd_nagios::main::dirs.pp
# Module name: cd_nagios
# Author: Arne Teuke (arne_teuke@ConfDroid.com)
# # License:
# This file is part of cd_nagios.
#
# cd_nagios is used for providing automatic configuration of Nagios.
# Copyright (C) 2016 ConfDroid (copyright@ConfDroid.com)
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation, either version 3 of the License, or
# (at your option) any later version.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with this program. If not, see <http://www.gnu.org/licenses/>.
# @summary Class manages all directories required for cd_nagios.
###############################################################################
class cd_nagios::main::dirs (
) inherits cd_nagios::params {
require cd_nagios::main::user
# main directory
file { $ng_main_dir:
ensure => directory,
path => $ng_main_dir,
owner => 'root',
group => 'root',
mode => '0755',
selrange => s0,
selrole => object_r,
seltype => nagios_etc_t,
seluser => system_u,
ensure => directory,
path => $ng_main_dir,
owner => 'root',
group => 'root',
mode => '0755',
selrange => s0,
selrole => object_r,
seltype => nagios_etc_t,
seluser => system_u,
}
# /usr/lib64/nagios dir required for plugins
file { $ng_lib_dir:
ensure => directory,
path => $ng_lib_dir,
owner => 'root',
group => 'root',
mode => '0755',
selrange => s0,
selrole => object_r,
seltype => lib_t,
seluser => system_u,
ensure => directory,
path => $ng_lib_dir,
owner => 'root',
group => 'root',
mode => '0755',
selrange => s0,
selrole => object_r,
seltype => lib_t,
seluser => system_u,
}
# /var/spool/nagios
file { $ng_spool_dir:
ensure => directory,
path => $ng_spool_dir,
owner => $ng_user,
group => $ng_user,
mode => '0755',
selrange => s0,
selrole => object_r,
seltype => nagios_spool_t,
seluser => system_u,
ensure => directory,
path => $ng_spool_dir,
owner => $ng_user,
group => $ng_user,
mode => '0755',
selrange => s0,
selrole => object_r,
seltype => nagios_spool_t,
seluser => system_u,
}
if $::fqdn == $ng_nagios_server {
# /etc/nagios/conf.d
file { $ng_conf_d_dir:
ensure => directory,
path => $ng_conf_d_dir,
owner => 'root',
group => $ng_user,
mode => '0750',
selrange => s0,
selrole => object_r,
seltype => nagios_etc_t,
seluser => system_u,
ensure => directory,
path => $ng_conf_d_dir,
owner => 'root',
group => $ng_user,
mode => '0750',
selrange => s0,
selrole => object_r,
seltype => nagios_etc_t,
seluser => system_u,
}
# /etc/nagios/objects
file { $ng_objects_dir:
ensure => directory,
path => $ng_objects_dir,
owner => 'root',
group => $ng_user,
mode => '0750',
selrange => s0,
selrole => object_r,
seltype => nagios_etc_t,
seluser => system_u,
ensure => directory,
path => $ng_objects_dir,
owner => 'root',
group => $ng_user,
mode => '0750',
selrange => s0,
selrole => object_r,
seltype => nagios_etc_t,
seluser => system_u,
}
# /etc/nagios/private
file { $ng_private_dir:
ensure => directory,
path => $ng_private_dir,
owner => 'root',
group => $ng_user,
mode => '0750',
selrange => s0,
selrole => object_r,
seltype => nagios_etc_t,
seluser => system_u,
ensure => directory,
path => $ng_private_dir,
owner => 'root',
group => $ng_user,
mode => '0750',
selrange => s0,
selrole => object_r,
seltype => nagios_etc_t,
seluser => system_u,
}
# include dir
file { $ng_usr_incl:
ensure => directory,
path => $ng_usr_incl,
owner => 'root',
group => 'root',
mode => '0755',
selrange => s0,
selrole => object_r,
seltype => usr_t,
seluser => system_u,
ensure => directory,
path => $ng_usr_incl,
owner => 'root',
group => 'root',
mode => '0755',
selrange => s0,
selrole => object_r,
seltype => usr_t,
seluser => system_u,
}
# log dir
file { $ng_log_dir:
ensure => directory,
path => $ng_log_dir,
owner => $ng_user,
group => $ng_user,
mode => '0750',
selrange => s0,
selrole => object_r,
seltype => nagios_log_t,
seluser => system_u,
ensure => directory,
path => $ng_log_dir,
owner => $ng_user,
group => $ng_user,
mode => '0750',
selrange => s0,
selrole => object_r,
seltype => nagios_log_t,
seluser => system_u,
}
# log archives
file { $ng_log_archives:
ensure => directory,
path => $ng_log_archives,
owner => $ng_user,
group => $ng_user,
mode => '0750',
selrange => s0,
selrole => object_r,
seltype => nagios_log_t,
seluser => system_u,
ensure => directory,
path => $ng_log_archives,
owner => $ng_user,
group => $ng_user,
mode => '0750',
selrange => s0,
selrole => object_r,
seltype => nagios_log_t,
seluser => system_u,
}
# /usr/share/nagios
file { $ng_usr_share:
ensure => directory,
path => $ng_usr_share,
owner => 'root',
group => 'root',
mode => '0755',
selrange => s0,
selrole => object_r,
seltype => usr_t,
seluser => system_u,
ensure => directory,
path => $ng_usr_share,
owner => 'root',
group => 'root',
mode => '0755',
selrange => s0,
selrole => object_r,
seltype => usr_t,
seluser => system_u,
}
# /usr/share/nagios/html
file { $ng_share_html:
ensure => directory,
path => $ng_share_html,
owner => 'root',
group => 'root',
mode => '0755',
selrange => s0,
selrole => object_r,
seltype => usr_t,
seluser => system_u,
ensure => directory,
path => $ng_share_html,
owner => 'root',
group => 'root',
mode => '0755',
selrange => s0,
selrole => object_r,
seltype => usr_t,
seluser => system_u,
}
# run dir for pid file
file { $ng_run_dir:
ensure => directory,
path => $ng_run_dir,
owner => 'nagios',
group => 'nagios',
mode => '0750',
selrange => s0,
selrole => object_r,
seltype => nagios_var_run_t,
seluser => system_u,
ensure => directory,
path => $ng_run_dir,
owner => 'nagios',
group => 'nagios',
mode => '0750',
selrange => s0,
selrole => object_r,
seltype => nagios_var_run_t,
seluser => system_u,
}
# cmd dir
file { $ng_cmd_dir:
ensure => directory,
path => $ng_cmd_dir,
owner => 'nagios',
group => 'nagios',
mode => '0775',
selrange => s0,
selrole => object_r,
seltype => nagios_spool_t,
seluser => system_u,
ensure => directory,
path => $ng_cmd_dir,
owner => 'nagios',
group => 'nagios',
mode => '0775',
selrange => s0,
selrole => object_r,
seltype => nagios_spool_t,
seluser => system_u,
}
# checkresults dir
file { $ng_checkresults_dir:
ensure => directory,
path => $ng_checkresults_dir,
owner => 'nagios',
group => 'nagios',
mode => '0770',
selrange => s0,
selrole => object_r,
seltype => nagios_spool_t,
seluser => system_u,
ensure => directory,
path => $ng_checkresults_dir,
owner => 'nagios',
group => 'nagios',
mode => '0770',
selrange => s0,
selrole => object_r,
seltype => nagios_spool_t,
seluser => system_u,
}
}
}

View File

@@ -1,23 +1,6 @@
## cd_nagios::main::install.pp
# Module name: cd_nagios
# Author: Arne Teuke (arne_teuke@ConfDroid.com)
# # License:
# This file is part of cd_nagios.
#
# cd_nagios is used for providing automatic configuration of Nagios.
# Copyright (C) 2016 ConfDroid (copyright@ConfDroid.com)
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation, either version 3 of the License, or
# (at your option) any later version.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with this program. If not, see <http://www.gnu.org/licenses/>.
# @summary Class manage all aspects of installing binaries required for
# cd_nagios
###############################################################################

View File

@@ -1,49 +1,31 @@
## cd_nagios::main::user.pp
# Module name: cd_nagios
# Author: Arne Teuke (arne_teuke@ConfDroid.com)
# # License:
# This file is part of cd_nagios.
#
# cd_nagios is used for providing automatic configuration of Nagios
# Copyright (C) 2016 ConfDroid (copyright@ConfDroid.com)
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation, either version 3 of the License, or
# (at your option) any later version.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with this program. If not, see <http://www.gnu.org/licenses/>.
# @summary Class manages service users for cd_nagios.
#############################################################################
class cd_nagios::main::user (
) inherits cd_nagios::params {
require cd_nagios::main::install
group { $ng_user:
ensure => present,
name => $ng_user,
gid => $ng_u_uid,
allowdupe => false,
ensure => present,
name => $ng_user,
gid => $ng_u_uid,
allowdupe => false,
}
user { $ng_user:
ensure => present,
name => $ng_user,
allowdupe => false,
comment => $ng_u_comment,
uid => $ng_u_uid,
gid => $ng_user,
groups => $ng_u_groups,
managehome => true,
home => $ng_user_home,
shell => $ng_user_shell,
require => Group[$ng_user],
user { $ng_user:
ensure => present,
name => $ng_user,
allowdupe => false,
comment => $ng_u_comment,
uid => $ng_u_uid,
gid => $ng_user,
groups => $ng_u_groups,
managehome => true,
home => $ng_user_home,
shell => $ng_user_shell,
require => Group[$ng_user],
}
}

View File

@@ -1,23 +1,6 @@
## cd_nagios::nagios::objects::add_contact.pp
# Module name: cd_nagios
# Author: Arne Teuke (arne_teuke@ConfDroid.com)
# # License:
# This file is part of cd_nagios.
#
# cd_nagios is used for providing automatic configuration of Nagios
# Copyright (C) 2016 ConfDroid (copyright@ConfDroid.com)
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation, either version 3 of the License, or
# (at your option) any later version.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with this program. If not, see <http://www.gnu.org/licenses/>.
# @summary Define manages additional contacts known to NAGIOS through external
# Puppet rules, and populates /etc/nagios/conf.d/nagios_add_contact.cfg.
# @example
@@ -28,30 +11,28 @@
# 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 Specidy the contact group for the contact.
# @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 (
$ng_contact_name = undef,
$ng_contact_use = 'generic-contact',
$ng_contact_alias = undef,
$ng_contact_email = undef,
$ng_contact_groups = undef,
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
$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),
target => $ng_target_add_contact,
content => template($ng_contacts_rule_erb),
}
}
}

View File

@@ -1,59 +1,40 @@
## cd_nagios::nagios::objects::add_contact_rules.pp
# Module name: cd_nagios
# Author: Arne Teuke (arne_teuke@ConfDroid.com)
# # License:
# This file is part of cd_nagios.
#
# cd_nagios is used for providing automatic configuration of Nagios
# Copyright (C) 2016 ConfDroid (copyright@ConfDroid.com)
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation, either version 3 of the License, or
# (at your option) any later version.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with this program. If not, see <http://www.gnu.org/licenses/>.
# @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',
# 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],
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',
target => $ng_target_add_contact,
content => template($ng_contacts_head_erb),
order => '000',
}
}
}

View File

@@ -1,50 +1,30 @@
## cd_nagios::nagios::objects::add_contactgroups.pp
# Module name: cd_nagios
# Author: Arne Teuke (arne_teuke@ConfDroid.com)
# # License:
# This file is part of cd_nagios.
#
# cd_nagios is used for providing automatic configuration of Nagios
# Copyright (C) 2016 ConfDroid (copyright@ConfDroid.com)
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation, either version 3 of the License, or
# (at your option) any later version.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with this program. If not, see <http://www.gnu.org/licenses/>
# @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
# @param [string] ng_contactgroup_alias Specify the alias (long name) of the
# contact group
# @param [string] ng_contactgroup_register Specify whether 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 (
$ng_contactgroup_name = undef,
$ng_contactgroup_alias = undef,
$ng_contactgroup_register = '1',
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
$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),
target => $ng_tgt_contactgroup_add,
content => template($ng_cntctgrps_rule_erb),
}
}
}

View File

@@ -1,60 +1,40 @@
## cd_nagios::nagios::objects::add_contactgroups_rules.pp
# Module name: cd_nagios
# Author: Arne Teuke (arne_teuke@ConfDroid.com)
# # License:
# This file is part of cd_nagios.
#
# cd_nagios is used for providing automatic configuration of Nagios
# Copyright (C) 2016 ConfDroid (copyright@ConfDroid.com)
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation, either version 3 of the License, or
# (at your option) any later version.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with this program. If not, see <http://www.gnu.org/licenses/>.
# @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',
# 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],
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',
target => $ng_tgt_contactgroup_add,
content => template($ng_cntctgrps_head_erb),
order => '000',
}
}
}

View File

@@ -1,59 +1,39 @@
## cd_nagios::nagios::objects::add_hostgroup_rules.pp
# Module name: cd_nagios
# Author: Arne Teuke (arne_teuke@ConfDroid.com)
# # License:
# This file is part of cd_nagios.
#
# cd_nagios is used for providing automatic configuration of Nagios
# Copyright (C) 2016 ConfDroid (copyright@ConfDroid.com)
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation, either version 3 of the License, or
# (at your option) any later version.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with this program. If not, see <http://www.gnu.org/licenses/>.
# @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',
# 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],
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',
target => $ng_tgt_hostgroup_add,
content => template($ng_tgt_hostgrp_head_erb),
order => '000',
}
}
}

View File

@@ -1,52 +1,32 @@
## cd_nagios::nagios::objects::add_hostgroups.pp
# Module name: cd_nagios
# Author: Arne Teuke (arne_teuke@ConfDroid.com)
# # License:
# This file is part of cd_nagios.
#
# cd_nagios is used for providing automatic configuration of Nagios
# Copyright (C) 2016 ConfDroid (copyright@ConfDroid.com)
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation, either version 3 of the License, or
# (at your option) any later version.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with this program. If not, see <http://www.gnu.org/licenses/>
# @summary define populates /etc/nagios/conf.d/nagios_hostgroups_add through
# extermal Puppet rules.
# 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.
# @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 (
$ng_hostgroup_name = undef,
$ng_hostgroup_alias = undef,
$ng_hostgroup_register = '1',
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
$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),
target => $ng_tgt_hostgroup_add,
content => template($ng_tgt_hostgrp_rule_erb),
}
}
}

View File

@@ -1,59 +1,39 @@
## cd_nagios::nagios::objects::add_servicegroup_rules.pp
# Module name: cd_nagios
# Author: Arne Teuke (arne_teuke@ConfDroid.com)
# # License:
# This file is part of cd_nagios.
#
# cd_nagios is used for providing automatic configuration of Nagios
# Copyright (C) 2016 ConfDroid (copyright@ConfDroid.com)
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation, either version 3 of the License, or
# (at your option) any later version.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with this program. If not, see <http://www.gnu.org/licenses/>.
# @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',
# 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],
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',
target => $ng_tgt_servicegroup_add,
content => template($ng_tgt_svcgrp_head_erb),
order => '000',
}
}
}

View File

@@ -2,52 +2,34 @@
# Module name: cd_nagios
# Author: Arne Teuke (arne_teuke@ConfDroid.com)
# # License:
# This file is part of cd_nagios.
#
# cd_nagios is used for providing automatic configuration of Nagios
# Copyright (C) 2016 ConfDroid (copyright@ConfDroid.com)
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation, either version 3 of the License, or
# (at your option) any later version.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with this program. If not, see <http://www.gnu.org/licenses/>
# @summary define populates /etc/nagios/conf.d/nagios_servicegroups_add through
# extermal Puppet rules.
# external Puppet rules.
# @example
# cd_nagios::nagios::objects::add_servicegroups { 'example_servicegroup':
# ng_servicegroup_name => 'example_servicegroup',
# ng_servicegroup_alias => '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_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
# @param [string] ng_servicegroup_register Whether you want to register the
# servicegroup
###############################################################################
define cd_nagios::nagios::objects::add_servicegroups (
$ng_servicegroup_name = undef,
$ng_servicegroup_alias = undef,
$ng_servicegroup_register = '1',
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
$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),
target => $ng_tgt_servicegroup_add,
content => template($ng_tgt_svcgrp_rule_erb),
}
}
}

View File

@@ -1,23 +1,6 @@
# cd_nagios::nagios::objects::add_timeperiod_rules.pp
# Module name: cd_nagios
# Author: Arne Teuke (arne_teuke@ConfDroid.com)
# # License:
# This file is part of cd_nagios.
#
# cd_nagios is used for providing automatic configuration of Nagios
# Copyright (C) 2016 ConfDroid (copyright@ConfDroid.com)
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation, either version 3 of the License, or
# (at your option) any later version.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with this program. If not, see <http://www.gnu.org/licenses/>.
# @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':
@@ -35,30 +18,28 @@
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],
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',
target => $ng_tgt_timep_add,
content => template($ng_tgt_timep_head_erb),
order => '000',
}
}
}

View File

@@ -1,23 +1,6 @@
## cd_nagios::nagios::objects::add_timeperiods.pp
# Module name: cd_nagios
# Author: Arne Teuke (arne_teuke@ConfDroid.com)
# # License:
# This file is part of cd_nagios.
#
# cd_nagios is used for providing automatic configuration of Nagios
# Copyright (C) 2016 ConfDroid (copyright@ConfDroid.com)
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation, either version 3 of the License, or
# (at your option) any later version.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with this program. If not, see <http://www.gnu.org/licenses/>
# @summary define populates /etc/nagios/conf.d/nagios_timeperiods_add through
# extermal Puppet rules.
# @example
@@ -32,39 +15,37 @@
# 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.
# @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 (
$ng_timep_name = undef,
$ng_timep_alias = undef,
$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',
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
$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),
target => $ng_tgt_timep_add,
content => template($ng_tgt_timep_rule_erb),
}
}
}

View File

@@ -1,240 +1,222 @@
## cd_nagios::nagios::objects::commands.pp
# Module name: cd_nagios
# Author: Arne Teuke (arne_teuke@ConfDroid.com)
# # License:
# This file is part of cd_nagios.
#
# cd_nagios is used for providing automatic configuration of Nagios
# Copyright (C) 2016 ConfDroid (copyright@ConfDroid.com)
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation, either version 3 of the License, or
# (at your option) any later version.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with this program. If not, see <http://www.gnu.org/licenses/>.
# @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,
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,
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,
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,
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,
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,
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,
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,
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,
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,
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,
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,
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,
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,
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,
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,
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,
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,
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,
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,
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,
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,31 +1,12 @@
## cd_nagios::server::nagios::objects::config.pp
# Module name: cd_nagios
# Author: Arne Teuke (arne_teuke@ConfDroid.com)
# # License:
# This file is part of cd_nagios.
#
# cd_nagios is used for providing automatic configuration of Nagios
# Copyright (C) 2016 ConfDroid (copyright@ConfDroid.com)
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation, either version 3 of the License, or
# (at your option) any later version.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with this program. If not, see <http://www.gnu.org/licenses/>.
# @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

View File

@@ -1,73 +1,54 @@
## cd_nagios::nagios::objects::contactgroups.pp
# Module name: cd_nagios
# Author: Arne Teuke (arne_teuke@ConfDroid.com)
# # License:
# This file is part of cd_nagios.
#
# cd_nagios is used for providing automatic configuration of Nagios
# Copyright (C) 2016 ConfDroid (copyright@ConfDroid.com)
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation, either version 3 of the License, or
# (at your option) any later version.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with this program. If not, see <http://www.gnu.org/licenses/>
# @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,
# 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,
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,
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,
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,39 +1,22 @@
## cd_nagios::nagios::objects::contacts.pp
# Module name: cd_nagios
# Author: Arne Teuke (arne_teuke@ConfDroid.com)
# # License:
# This file is part of cd_nagios.
#
# cd_nagios is used for providing automatic configuration of Nagios
# Copyright (C) 2016 ConfDroid (copyright@ConfDroid.com)
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation, either version 3 of the License, or
# (at your option) any later version.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with this program. If not, see <http://www.gnu.org/licenses/>.
# @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',
# 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 (
@@ -46,52 +29,52 @@ class cd_nagios::nagios::objects::contacts (
# 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',
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',
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',
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,227 +1,207 @@
## cd_nagios::nagios::objects::hostgroups.pp
# Module name: cd_nagios
# Author: Arne Teuke (arne_teuke@ConfDroid.com)
# # License:
# This file is part of cd_nagios.
#
# cd_nagios is used for providing automatic configuration of Nagios
# Copyright (C) 2016 ConfDroid (copyright@ConfDroid.com)
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation, either version 3 of the License, or
# (at your option) any later version.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with this program. If not, see <http://www.gnu.org/licenses/>.
# @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,
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,
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,
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,
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,
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,
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,
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,
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,
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,
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,
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,
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,
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,
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,
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,70 +1,50 @@
## cd_nagios::nagios::objects::servicegroups.pp
# Module name: cd_nagios
# Author: Arne Teuke (arne_teuke@ConfDroid.com)
# # License:
# This file is part of cd_nagios.
#
# cd_nagios is used for providing automatic configuration of Nagios
# Copyright (C) 2016 ConfDroid (copyright@ConfDroid.com)
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation, either version 3 of the License, or
# (at your option) any later version.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with this program. If not, see <http://www.gnu.org/licenses/>.
# @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,
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,
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,
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,102 +1,82 @@
## cd_nagios::nagios::objects::template_rules.pp
# Module name: cd_nagios
# Author: Arne Teuke (arne_teuke@ConfDroid.com)
# # License:
# This file is part of cd_nagios.
#
# cd_nagios is used for providing automatic configuration of Nagios
# Copyright (C) 2016 ConfDroid (copyright@ConfDroid.com)
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation, either version 3 of the License, or
# (at your option) any later version.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with this program. If not, see <http://www.gnu.org/licenses/>.
# @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',
# 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],
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',
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',
ng_template_object_name => 'generic-contact',
}
cd_nagios::nagios::objects::templates { 'generic-host':
ng_template_object => 'host',
ng_template_object_name => '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',
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',
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',
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',
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',
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',
ng_template_object => 'service',
ng_template_object_name => 'local-service',
ng_max_check_attempts => '4',
ng_template_object_use => 'generic-service',
}
}
}

View File

@@ -1,33 +1,16 @@
## cd_nagios::nagios::objects::templates.pp
# Module name: cd_nagios
# Author: Arne Teuke (arne_teuke@ConfDroid.com)
# # License:
# This file is part of cd_nagios.
#
# cd_nagios is used for providing automatic configuration of Nagios
# Copyright (C) 2016 ConfDroid (copyright@ConfDroid.com)
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation, either version 3 of the License, or
# (at your option) any later version.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with this program. If not, see <http://www.gnu.org/licenses/>.
# @summary Define manages populates /etc/nagios/conf.d/templates.cfg.
# @param [string] ng_template_object the object type for the templates.
# @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,
# @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
# @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
# @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
# @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,
@@ -35,7 +18,7 @@
# 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
# @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,
@@ -43,100 +26,98 @@
# 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
# @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
# @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.
# @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
# @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.
# @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.
# @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.
# @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.
# @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
# @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
# @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
# @param [String] ng_notification_period Which period in to send out
# notifications. for the defined service or host.
# @param [string] ng_notification_interval Whoe often (in minutes) we should
# @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
# @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
# @param [String] ng_max_check_attempts how often to check the defined object
# maximal.
# @param [string] ng_notification_options see `ng_service_notification_options`
# @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 oject.
# @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.
# @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.
# @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
# @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.
# @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.
# @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.
# @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
# @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
# @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
# @param [String] ng_host_check_command the check command for host checks
################################################################################
define cd_nagios::nagios::objects::templates (
$ng_template_object = undef,
$ng_template_object_name = undef,
$ng_svc_notification_period = '24x7',
$ng_host_notification_period = '24x7',
$ng_service_notification_options = 'w,u,c,r,f,s',
$ng_host_notification_options = 'd,u,r,f,s',
$ng_service_notification_commands = 'notify-service-by-email',
$ng_host_notification_commands = 'notify-host-by-email',
$ng_object_register = '0',
$ng_template_object_use = undef,
$ng_notifications_enabled = '1',
$ng_event_handler_enabled = '1',
$ng_flap_detection_enabled = '1',
$ng_process_perf_data = '1',
$ng_retain_status_information = '1',
$ng_retain_nonstatus_information = '1',
$ng_notification_period = '24x7',
$ng_notification_interval = '30',
$ng_check_period = '24x7',
$ng_check_interval = '5',
$ng_retry_interval = '1',
$ng_max_check_attempts = '10',
$ng_host_check_command = 'check-host-alive',
$ng_notification_options = undef,
$ng_contact_groups = 'admins',
$ng_active_checks_enabled = '1',
$ng_passive_checks_enabled = '1',
$ng_parallelize_check = '1',
$ng_obsess_over_service = '1',
$ng_check_freshness = '0',
$ng_is_volatile = '0',
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
$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),
concat::fragment { $name:
target => $ng_target_templates,
content => template($ng_templates_rule_erb),
}
}
}

View File

@@ -1,95 +1,76 @@
# cd_nagios::nagios::objects::timeperiods.pp
# Module name: cd_nagios
# Author: Arne Teuke (arne_teuke@ConfDroid.com)
# # License:
# This file is part of cd_nagios.
#
# cd_nagios is used for providing automatic configuration of Nagios
# Copyright (C) 2016 ConfDroid (copyright@ConfDroid.com)
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation, either version 3 of the License, or
# (at your option) any later version.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with this program. If not, see <http://www.gnu.org/licenses/>.
# @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,
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,
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,
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,
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,
}
}
}

View File

@@ -28,25 +28,23 @@
class cd_nagios::nagios::resources::resource (
) inherits cd_nagios::params {
if $fqdn == $ng_nagios_server {
concat { $ng_resource_file:
ensure => present,
owner => 'root',
group => $ng_user,
mode => '0640',
selrange => s0,
selrole => object_r,
seltype => nagios_etc_t,
seluser => system_u,
notify => Service[$ng_service],
ensure => present,
owner => 'root',
group => $ng_user,
mode => '0640',
selrange => s0,
selrole => object_r,
seltype => nagios_etc_t,
seluser => system_u,
notify => Service[$ng_service],
}
concat::fragment { 'header':
target => $ng_resource_file,
content => template($ng_resource_erb),
order => '000',
target => $ng_resource_file,
content => template($ng_resource_erb),
order => '000',
}
# plugins rule

View File

@@ -1,45 +1,28 @@
## cd_nagios::nagios::resources::resource_df.pp
# Module name: cd_nagios
# Author: Arne Teuke (arne_teuke@ConfDroid.com)
# # License:
# This file is part of cd_nagios.
#
# cd_nagios is used for providing automatic configuration of Nagios
# Copyright (C) 2016 ConfDroid (copyright@ConfDroid.com)
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation, either version 3 of the License, or
# (at your option) any later version.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with this program. If not, see <http://www.gnu.org/licenses/>.
# @summary define manages the resources in/etc/nagios/private/resources.cfg
# @param [string] ng_user_arg_name the name of the user argument i.e. $user1$
# @param [String] ng_user_arg_name the name of user argument i.e. $user1$
# @param [String] ng_user_arg_value the value of t user argument i.e. $user1$
# @param [String] ng_user_arg_comment the argument i.e. $user1$
# @param [String] ng_resource_rule_erb resource rule #
#############################################################################
define cd_nagios::nagios::resources::resource_df (
$ng_user_arg_name = undef,
$ng_user_arg_value = undef,
$ng_user_arg_comment = undef,
$ng_resource_rule_erb = 'cd_nagios/nagios/resource_cfg_rule.erb',
Optional[String] $ng_user_arg_name = undef,
Optional[String] $ng_user_arg_value = undef,
Optional[String] $ng_user_arg_comment = undef,
String $ng_resource_rule_erb = 'cd_nagios/nagios/resource_cfg_rule.erb',
) {
$ng_nagios_server = $::cd_nagios::params::ng_nagios_server
$ng_resource_file = $::cd_nagios::params::ng_resource_file
$ng_nagios_server = $cd_nagios::params::ng_nagios_server
$ng_resource_file = $cd_nagios::params::ng_resource_file
if $fqdn == $ng_nagios_server {
concat::fragment { "rule_${name}":
target => $ng_resource_file,
content => template($ng_resource_rule_erb),
order => '000',
target => $ng_resource_file,
content => template($ng_resource_rule_erb),
order => '000',
}
}
}

File diff suppressed because it is too large Load Diff

View File

@@ -1,160 +1,141 @@
## cd_nagios::selinux::config.pp
# Module name: cd_nagios
# Author: Arne Teuke (arne_teuke@ConfDroid.com)
# # License:
# This file is part of cd_nagios.
#
# cd_nagios is used for providing automatic configuration of Nagios
# Copyright (C) 2016 ConfDroid (copyright@ConfDroid.com)
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation, either version 3 of the License, or
# (at your option) any later version.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with this program. If not, see <http://www.gnu.org/licenses/>.
# @summary Class manages all aspects of selinux for cd_nagios.
##############################################################################
class cd_nagios::selinux::config (
) inherits cd_nagios::params {
if $ng_use_selinux_tools == true {
require cd_selinux
# it appears that selinux hehaves differently accross different nodes,
# so all we can do for now is to create a list of the AVC alerts and come up
# with a solution on that later.
# it appears that selinux behaves differently across different nodes,
# so all we can do for now is to create a list of the AVC alerts and come up
# with a solution on that later.
exec { 'create_avc_list':
command => 'sealert -a /var/log/audit/audit.log > avc_alerts',
cwd => $ng_user_home,
path => ['/usr/bin'],
creates => "${ng_user_home}/avc_alerts",
command => 'sealert -a /var/log/audit/audit.log > avc_alerts',
cwd => $ng_user_home,
path => ['/usr/bin'],
creates => "${ng_user_home}/avc_alerts",
}
# sealert tac-cgi
# exec { 'create_policy_taccgi':
# command => template($ng_taccgi_erb),
# path => ['/usr/bin','/usr/sbin'],
# user => $ng_user,
# cwd => $ng_user_home,
# creates => "${ng_user_home}/my-taccgi.pp",
# notify => Exec['semodule_taccgi'],
# command => template($ng_taccgi_erb),
# path => ['/usr/bin','/usr/sbin'],
# user => $ng_user,
# cwd => $ng_user_home,
# creates => "${ng_user_home}/my-taccgi.pp",
# notify => Exec['semodule_taccgi'],
# }
# exec { 'semodule_taccgi':
# command => "semodule -i ${ng_user_home}/my-taccgi.pp",
# path => ['/usr/bin','/usr/sbin'],
# user => $ng_user,
# cwd => $ng_user_home,
# require => Exec['create_policy_taccgi'],
# refreshonly => true,
# command => "semodule -i ${ng_user_home}/my-taccgi.pp",
# path => ['/usr/bin','/usr/sbin'],
# user => $ng_user,
# cwd => $ng_user_home,
# require => Exec['create_policy_taccgi'],
# refreshonly => true,
# }
# sealert status.cgi
# exec { 'create_policy_statuscgi':
# command => template($ng_statcgi_erb),
# path => ['/usr/bin','/usr/sbin'],
# cwd => $ng_user_home,
# creates => "${ng_user_home}/my-statuscgi.pp",
# notify => Exec['semodule_statuscgi'],
# command => template($ng_statcgi_erb),
# path => ['/usr/bin','/usr/sbin'],
# cwd => $ng_user_home,
# creates => "${ng_user_home}/my-statuscgi.pp",
# notify => Exec['semodule_statuscgi'],
# }
# exec { 'semodule_statuscgi':
# command => 'semodule -i my-statuscgi.pp',
# path => ['/usr/bin','/usr/sbin'],
# cwd => $ng_user_home,
# require => Exec['create_policy_statuscgi'],
# refreshonly => true,
# notify => Service[$ng_service],
# command => 'semodule -i my-statuscgi.pp',
# path => ['/usr/bin','/usr/sbin'],
# cwd => $ng_user_home,
# require => Exec['create_policy_statuscgi'],
# refreshonly => true,
# notify => Service[$ng_service],
# }
# sealert check_nrpe
# exec { 'create_policy_checknrpe':
# command => template($ng_checknrpe_erb),
# path => ['/usr/bin','/usr/sbin'],
# cwd => $ng_user_home,
# creates => "${ng_user_home}/my-checknrpe.pp",
# notify => Exec['semodule_checknrpe'],
# command => template($ng_checknrpe_erb),
# path => ['/usr/bin','/usr/sbin'],
# cwd => $ng_user_home,
# creates => "${ng_user_home}/my-checknrpe.pp",
# notify => Exec['semodule_checknrpe'],
# }
# exec { 'semodule_checknrpe':
# command => 'semodule -i my-checknrpe.pp',
# path => ['/usr/bin','/usr/sbin'],
# cwd => $ng_user_home,
# require => Exec['create_policy_checknrpe'],
# refreshonly => true,
# notify => Service[$ng_service],
# command => 'semodule -i my-checknrpe.pp',
# path => ['/usr/bin','/usr/sbin'],
# cwd => $ng_user_home,
# require => Exec['create_policy_checknrpe'],
# refreshonly => true,
# notify => Service[$ng_service],
# }
# selart check_nagios
# sealert check_nagios
# exec { 'create_policy_checknagios':
# command => template($ng_checknagios_erb),
# path => ['/usr/bin','/usr/sbin'],
# cwd => $ng_user_home,
# creates => "${ng_user_home}/my-checknagios.pp",
# notify => Exec['semodule_checknagios'],
# command => template($ng_checknagios_erb),
# path => ['/usr/bin','/usr/sbin'],
# cwd => $ng_user_home,
# creates => "${ng_user_home}/my-checknagios.pp",
# notify => Exec['semodule_checknagios'],
# }
# exec { 'semodule_checknagios':
# command => 'semodule -i my-checknagios.pp',
# path => ['/usr/bin','/usr/sbin'],
# cwd => $ng_user_home,
# require => Exec['create_policy_checknagios'],
# refreshonly => true,
# notify => Service[$ng_service],
# command => 'semodule -i my-checknagios.pp',
# path => ['/usr/bin','/usr/sbin'],
# cwd => $ng_user_home,
# require => Exec['create_policy_checknagios'],
# refreshonly => true,
# notify => Service[$ng_service],
# }
# sealert status.dat
exec { 'create_policy_statusdat':
command => template($ng_statdat_erb),
path => ['/usr/bin','/usr/sbin'],
user => $ng_user,
cwd => $ng_user_home,
creates => "${ng_user_home}/my-http.pp",
notify => Exec['semodule_statusdat'],
command => template($ng_statdat_erb),
path => ['/usr/bin','/usr/sbin'],
user => $ng_user,
cwd => $ng_user_home,
creates => "${ng_user_home}/my-http.pp",
notify => Exec['semodule_statusdat'],
}
exec { 'semodule_statusdat':
command => "semodule -i ${ng_user_home}/my-httpd.pp",
path => ['/usr/bin','/usr/sbin'],
user => $ng_user,
cwd => $ng_user_home,
require => Exec['create_policy_statusdat'],
refreshonly => true,
notify => Service[$ng_service],
command => "semodule -i ${ng_user_home}/my-httpd.pp",
path => ['/usr/bin','/usr/sbin'],
user => $ng_user,
cwd => $ng_user_home,
require => Exec['create_policy_statusdat'],
refreshonly => true,
notify => Service[$ng_service],
}
# sealert grep
exec { 'create_policy_grep':
command => template($ng_grep_erb),
path => ['/usr/bin','/usr/sbin'],
user => $ng_user,
cwd => $ng_user_home,
creates => "${ng_user_home}/my-grep.pp",
notify => Exec['semodule_statusdat'],
command => template($ng_grep_erb),
path => ['/usr/bin','/usr/sbin'],
user => $ng_user,
cwd => $ng_user_home,
creates => "${ng_user_home}/my-grep.pp",
notify => Exec['semodule_statusdat'],
}
exec { 'semodule_grep':
command => "semodule -i ${ng_user_home}/my-grep.pp",
path => ['/usr/bin','/usr/sbin'],
user => $ng_user,
cwd => $ng_user_home,
require => Exec['create_policy_grep'],
refreshonly => true,
notify => Service[$ng_service],
command => "semodule -i ${ng_user_home}/my-grep.pp",
path => ['/usr/bin','/usr/sbin'],
user => $ng_user,
cwd => $ng_user_home,
require => Exec['create_policy_grep'],
refreshonly => true,
notify => Service[$ng_service],
}
}
}

View File

@@ -1,48 +1,28 @@
## cd_nagios::server::access.pp
# Module name: cd_nagios
# Author: Arne Teuke (arne_teuke@ConfDroid.com)
# # License:
# This file is part of cd_nagios.
#
# cd_nagios is used for providing automatic configuration of Nagios
# Copyright (C) 2016 ConfDroid (copyright@ConfDroid.com)
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation, either version 3 of the License, or
# (at your option) any later version.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with this program. If not, see <http://www.gnu.org/licenses/>.
# @summary Define manages user- and password rules for accessing nagios.
# @param [string] ng_htpasswd_user user name for the /etc/nagios/passwd file
# @param [string] ng_htpasswd_password the encrypted password for the
# @param [string] ng_htpasswd_user user name for the /etc/nagios/passwd file
# @param [string] ng_htpasswd_password the encrypted password for the
# /etc/nagios/passwd file.
##############################################################################
define cd_nagios::server::access (
$ng_htpasswd_user = undef,
$ng_htpasswd_password = undef,
Optional[String] $ng_htpasswd_user = undef,
Optional[String] $ng_htpasswd_password = undef,
) {
$ng_nagios_server = $::cd_nagios::params::ng_nagios_server
$ng_htpasswd_file = $::cd_nagios::params::ng_htpasswd_file
$ng_htpasswd_rule = $::cd_nagios::params::ng_htpasswd_rule
$ng_service = $::cd_nagios::params::ng_service
$ng_nagios_server = $cd_nagios::params::ng_nagios_server
$ng_htpasswd_file = $cd_nagios::params::ng_htpasswd_file
$ng_htpasswd_rule = $cd_nagios::params::ng_htpasswd_rule
$ng_service = $cd_nagios::params::ng_service
if $::fqdn == $ng_nagios_server {
# create password rules
concat::fragment { $name:
target => $ng_htpasswd_file,
content => template($ng_htpasswd_rule),
target => $ng_htpasswd_file,
content => template($ng_htpasswd_rule),
}
}
}

View File

@@ -1,49 +1,30 @@
## cd_nagios::server::access_rules.pp
# Module name: cd_nagios
# Author: Arne Teuke (arne_teuke@ConfDroid.com)
# # License:
# This file is part of cd_nagios.
#
# cd_nagios is used for providing automatic configuration of Nagios
# Copyright (C) 2016 ConfDroid (copyright@ConfDroid.com)
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation, either version 3 of the License, or
# (at your option) any later version.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with this program. If not, see <http://www.gnu.org/licenses/>.
# @summary Class manages presennce of /etc/nagios/phtpasswd file.
# @summary Class manages presence of /etc/nagios/phtpasswd file.
# @example
# cd_nagios::server::access { 'example':
# ng_htpasswd_user => 'example_user',
# ng_htpasswd_password => 'example_password_encrypted',
# ng_htpasswd_user => 'example_user',
# ng_htpasswd_password => 'example_password_encrypted',
# }
##############################################################################
class cd_nagios::server::access_rules (
) inherits cd_nagios::params {
if $::fqdn == $ng_nagios_server {
# manage /etc/nagios/htpasswd file
concat { $ng_htpasswd_file:
ensure => present,
path => $ng_htpasswd_file,
owner => 'root',
group => 'apache',
mode => '0640',
selrange => s0,
selrole => object_r,
seltype => nagios_etc_t,
seluser => system_u,
notify => Service[$ng_service],
ensure => present,
path => $ng_htpasswd_file,
owner => 'root',
group => 'apache',
mode => '0640',
selrange => s0,
selrole => object_r,
seltype => nagios_etc_t,
seluser => system_u,
notify => Service[$ng_service],
}
}
}

View File

@@ -1,29 +1,11 @@
## cd_nagios::server::files.pp
# Module name: cd_nagios
# Author: Arne Teuke (arne_teuke@ConfDroid.com)
# # License:
# This file is part of cd_nagios.
#
# cd_nagios is used for providing automatic configuration of Nagios
# Copyright (C) 2016 ConfDroid (copyright@ConfDroid.com)
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation, either version 3 of the License, or
# (at your option) any later version.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with this program. If not, see <http://www.gnu.org/licenses/>.
# @summary Class manages all configuration files required for cd_nagios.
##############################################################################
class cd_nagios::server::files (
) inherits cd_nagios::params {
if $::fqdn == $ng_nagios_server {
if $ng_use_https == true {
if $ng_enable_certbot == true {
@@ -36,33 +18,33 @@ class cd_nagios::server::files (
# manage nagios.cfg
file { $ng_nagios_cfg_file:
ensure => file,
path => $ng_nagios_cfg_file,
owner => 'root',
group => 'root',
mode => '0644',
selrange => s0,
selrole => object_r,
seltype => nagios_etc_t,
seluser => system_u,
content => template($ng_nagios_cfg_erb),
notify => Service[$ng_service],
ensure => file,
path => $ng_nagios_cfg_file,
owner => 'root',
group => 'root',
mode => '0644',
selrange => s0,
selrole => object_r,
seltype => nagios_etc_t,
seluser => system_u,
content => template($ng_nagios_cfg_erb),
notify => Service[$ng_service],
}
# manage cgi.cfg
file { $ng_cgi_cfg_file:
ensure => file,
path => $ng_cgi_cfg_file,
owner => 'root',
group => 'root',
mode => '0644',
selrange => s0,
selrole => object_r,
seltype => nagios_etc_t,
seluser => system_u,
content => template($ng_cgi_cfg_erb),
notify => Service[$ng_service],
ensure => file,
path => $ng_cgi_cfg_file,
owner => 'root',
group => 'root',
mode => '0644',
selrange => s0,
selrole => object_r,
seltype => nagios_etc_t,
seluser => system_u,
content => template($ng_cgi_cfg_erb),
notify => Service[$ng_service],
}
## Apache files
@@ -70,48 +52,46 @@ class cd_nagios::server::files (
# after upgrades to avoid conflicts
file { $ng_nagios_conf:
ensure => absent,
ensure => absent,
}
file { $ng_forward_conf:
ensure => file,
path => $ng_forward_conf,
owner => 'root',
group => 'root',
mode => '0644',
selrange => s0,
selrole => object_r,
seltype => httpd_config_t,
seluser => system_u,
content => template($ng_forward_conf_erb),
notify => Service[$ae_service],
ensure => file,
path => $ng_forward_conf,
owner => 'root',
group => 'root',
mode => '0644',
selrange => s0,
selrole => object_r,
seltype => httpd_config_t,
seluser => system_u,
content => template($ng_forward_conf_erb),
notify => Service[$ae_service],
}
if $ng_use_https == true {
# create ssl vhost
file { $ng_ssl_vhost_file:
ensure => file,
path => $ng_ssl_vhost_file,
owner => 'root',
group => 'root',
mode => '0644',
selrange => s0,
selrole => object_r,
seltype => httpd_config_t,
seluser => system_u,
content => template($ng_ssl_vhost_erb),
notify => Service[$ae_service],
ensure => file,
path => $ng_ssl_vhost_file,
owner => 'root',
group => 'root',
mode => '0644',
selrange => s0,
selrole => object_r,
seltype => httpd_config_t,
seluser => system_u,
content => template($ng_ssl_vhost_erb),
notify => Service[$ae_service],
}
}
if $ng_use_https != true {
# remove ssl_vhost
file { $ng_ssl_vhost_file:
ensure => absent,
ensure => absent,
}
}
}

View File

@@ -1,32 +1,14 @@
## cd_nagios::server::service.pp
# Module name: cd_nagios
# Author: Arne Teuke (arne_teuke@ConfDroid.com)
# # License:
# This file is part of cd_nagios.
#
# cd_nagios is used for providing automatic configuration of Nagios
# Copyright (C) 2016 ConfDroid (copyright@ConfDroid.com)
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation, either version 3 of the License, or
# (at your option) any later version.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with this program. If not, see <http://www.gnu.org/licenses/>.
# @summary Class manages the service(s) for cd_nagios.
#############################################################################
class cd_nagios::server::service (
) inherits cd_nagios::params {
if $::fqdn == $ng_nagios_server {
if $ng_include_nrpe == true {
require cd_nrpe
require cd_nrpe
}
require cd_nagios::server::files
@@ -35,185 +17,182 @@ class cd_nagios::server::service (
require cd_nagios::nagios::resources::resource
service { $ng_service:
ensure => running,
hasstatus => true,
hasrestart => true,
enable => true,
ensure => running,
hasstatus => true,
hasrestart => true,
enable => true,
}
@@nagios_host { 'localhost':
ensure => $ng_ping_ensure,
alias => 'localhost',
address => '127.0.0.1',
use => 'linux-server',
target => $ng_target_localhost,
hostgroups => 'linux-servers',
contacts => 'ops',
max_check_attempts => $ng_max_check_attempts,
notification_period => '24x7',
owner => $ng_user,
group => $ng_user,
mode => '0640',
check_command => "check_ping!${ng_ping_warn}!${ng_ping_crit}",
notify => Service[$ng_service],
ensure => $ng_ping_ensure,
alias => 'localhost',
address => '127.0.0.1',
use => 'linux-server',
target => $ng_target_localhost,
hostgroups => 'linux-servers',
contacts => 'ops',
max_check_attempts => $ng_max_check_attempts,
notification_period => '24x7',
owner => $ng_user,
group => $ng_user,
mode => '0640',
check_command => "check_ping!${ng_ping_warn}!${ng_ping_crit}",
notify => Service[$ng_service],
}
@@nagios_service { 'check_nagios_localhost':
check_command => $ng_nagios_service_cmd,
check_command => $ng_nagios_service_cmd,
use => 'generic-service',
host_name => 'localhost',
notification_period => '24x7',
service_description => 'localhost_nagios_service',
target => $ng_target_service,
owner => $ng_user,
group => $ng_user,
mode => '0640',
contacts => 'ops',
}
@@nagios_host { $::fqdn:
ensure => $ng_ping_ensure,
alias => $::hostname,
address => $::fqdn,
use => 'linux-server',
target => $ng_target_host,
hostgroups => 'linux-servers',
contacts => 'ops',
max_check_attempts => $ng_max_check_attempts,
notification_period => '24x7',
owner => $ng_user,
group => $ng_user,
mode => '0640',
check_command => "check_ping!${ng_ping_warn}!${ng_ping_crit}",
notify => Service[$ng_user],
}
@@nagios_service { "root_partition_${::hostname}":
ensure => $ng_disk_ensure,
check_command => "check_nrpe!check_disk!${ng_disk_warn}!${ng_disk_crit}!/",
use => 'generic-service',
host_name => $::fqdn,
contacts => 'ops',
notification_period => '24x7',
service_description => "${::hostname}_root_partition",
servicegroups => 'linux-services',
target => $ng_target_service,
owner => $ng_user,
group => $ng_user,
mode => '0640',
}
if $ng_enable_swap_check == true {
@@nagios_service { "Swap_Usage_${::hostname}":
ensure => $ng_swap_ensure,
check_command => "check_nrpe!check_swap!${ng_swap_warn}!${ng_swap_crit}",
use => 'generic-service',
host_name => 'localhost',
host_name => $::fqdn,
contacts => 'ops',
notification_period => '24x7',
service_description => 'localhost_nagios_service',
service_description => "${::hostname}_swap_usage",
servicegroups => 'linux-services',
target => $ng_target_service,
owner => $ng_user,
group => $ng_user,
mode => '0640',
contacts => 'ops',
}
@@nagios_host { $::fqdn:
ensure => $ng_ping_ensure,
alias => $::hostname,
address => $::fqdn,
use => 'linux-server',
target => $ng_target_host,
hostgroups => 'linux-servers',
contacts => 'ops',
max_check_attempts => $ng_max_check_attempts,
notification_period => '24x7',
owner => $ng_user,
group => $ng_user,
mode => '0640',
check_command => "check_ping!${ng_ping_warn}!${ng_ping_crit}",
notify => Service[$ng_user],
}
@@nagios_service { "root_partition_${::hostname}":
ensure => $ng_disk_ensure,
check_command => "check_nrpe!check_disk!${ng_disk_warn}!${ng_disk_crit}!/",
use => 'generic-service',
host_name => $::fqdn,
contacts => 'ops',
notification_period => '24x7',
service_description => "${::hostname}_root_partition",
servicegroups => 'linux-services',
target => $ng_target_service,
owner => $ng_user,
group => $ng_user,
mode => '0640',
}
if $ng_enable_swap_check == true {
@@nagios_service { "Swap_Usage_${::hostname}":
ensure => $ng_swap_ensure,
check_command => "check_nrpe!check_swap!${ng_swap_warn}!${ng_swap_crit}",
use => 'generic-service',
host_name => $::fqdn,
contacts => 'ops',
notification_period => '24x7',
service_description => "${::hostname}_swap_usage",
servicegroups => 'linux-services',
target => $ng_target_service,
owner => $ng_user,
group => $ng_user,
mode => '0640',
}
}
@@nagios_service { "Local_Users_${::hostname}":
ensure => $ng_users_ensure,
check_command => "check_nrpe!check_users!${ng_users_warn}!${ng_users_crit}",
use => 'generic-service',
host_name => $::fqdn,
contacts => 'ops',
notification_period => '24x7',
service_description => "${::hostname}_local_users",
servicegroups => 'linux-services',
target => $ng_target_service,
owner => $ng_user,
group => $ng_user,
mode => '0640',
ensure => $ng_users_ensure,
check_command => "check_nrpe!check_users!${ng_users_warn}!${ng_users_crit}",
use => 'generic-service',
host_name => $::fqdn,
contacts => 'ops',
notification_period => '24x7',
service_description => "${::hostname}_local_users",
servicegroups => 'linux-services',
target => $ng_target_service,
owner => $ng_user,
group => $ng_user,
mode => '0640',
}
@@nagios_service { "Total Processes_${::hostname}":
ensure => $ng_procs_tot_ens,
check_command => "check_nrpe!check_procs!${ng_procs_tot_warn}!${ng_procs_tot_crit}!${ng_procs_tot_param}",
use => 'generic-service',
host_name => $::fqdn,
contacts => 'ops',
notification_period => '24x7',
service_description => "${::hostname}_total_processes",
servicegroups => 'linux-services',
target => $ng_target_service,
owner => $ng_user,
group => $ng_user,
mode => '0640',
ensure => $ng_procs_tot_ens,
check_command => "check_nrpe!check_procs!${ng_procs_tot_warn}!${ng_procs_tot_crit}!${ng_procs_tot_param}",
use => 'generic-service',
host_name => $::fqdn,
contacts => 'ops',
notification_period => '24x7',
service_description => "${::hostname}_total_processes",
servicegroups => 'linux-services',
target => $ng_target_service,
owner => $ng_user,
group => $ng_user,
mode => '0640',
}
@@nagios_service { "Zombie Processes_${::hostname}":
ensure => $ng_procs_z_ensure,
check_command => "check_nrpe!check_procs!${ng_procs_z_warn}!${ng_procs_z_crit}!${ng_procs_z_param}",
use => 'generic-service',
host_name => $::fqdn,
contacts => 'ops',
notification_period => '24x7',
service_description => "${::hostname}_zombie_processes",
servicegroups => 'linux-services',
target => $ng_target_service,
owner => $ng_user,
group => $ng_user,
mode => '0640',
ensure => $ng_procs_z_ensure,
check_command => "check_nrpe!check_procs!${ng_procs_z_warn}!${ng_procs_z_crit}!${ng_procs_z_param}",
use => 'generic-service',
host_name => $::fqdn,
contacts => 'ops',
notification_period => '24x7',
service_description => "${::hostname}_zombie_processes",
servicegroups => 'linux-services',
target => $ng_target_service,
owner => $ng_user,
group => $ng_user,
mode => '0640',
}
@@nagios_service { "Current_Load_${::hostname}":
ensure => $ng_load_ensure,
check_command => "check_nrpe!check_load!${ng_load_warn}!${ng_load_crit}",
use => 'generic-service',
host_name => $::fqdn,
contacts => 'ops',
notification_period => '24x7',
service_description => "${::hostname}_current_load",
servicegroups => 'linux-services',
target => $ng_target_service,
owner => $ng_user,
group => $ng_user,
mode => '0640',
ensure => $ng_load_ensure,
check_command => "check_nrpe!check_load!${ng_load_warn}!${ng_load_crit}",
use => 'generic-service',
host_name => $::fqdn,
contacts => 'ops',
notification_period => '24x7',
service_description => "${::hostname}_current_load",
servicegroups => 'linux-services',
target => $ng_target_service,
owner => $ng_user,
group => $ng_user,
mode => '0640',
}
resources { [ 'nagios_host',
'nagios_hostgroup',
'nagios_hostdependency',
'nagios_hostescalation',
'nagios_hostextinfo',
'nagios_service',
'nagios_servicegroup',
'nagios_servicedependency',
'nagios_serviceescalation',
'nagios_serviceextinfo',
'nagios_contact',
'nagios_contactgroup',
'nagios_command',
'nagios_timeperiod' ]:
resources { ['nagios_host',
'nagios_hostgroup',
'nagios_hostdependency',
'nagios_hostescalation',
'nagios_hostextinfo',
'nagios_service',
'nagios_servicegroup',
'nagios_servicedependency',
'nagios_serviceescalation',
'nagios_serviceextinfo',
'nagios_contact',
'nagios_contactgroup',
'nagios_command',
'nagios_timeperiod']:
purge => true,
}
# collect resources and populate /etc/nagios/conf.d/nagios_*.cfg
Nagios_host <<||>> { notify => Service['nagios'] }
Nagios_hostgroup <<||>> { notify => Service['nagios'] }
Nagios_hostdependency <<||>> { notify => Service['nagios'] }
Nagios_hostescalation <<||>> { notify => Service['nagios'] }
Nagios_hostextinfo <<||>> { notify => Service['nagios'] }
Nagios_service <<||>> { notify => Service['nagios'] }
Nagios_servicegroup <<||>> { notify => Service['nagios'] }
Nagios_servicedependency <<||>> { notify => Service['nagios'] }
Nagios_serviceescalation <<||>> { notify => Service['nagios'] }
Nagios_serviceextinfo <<||>> { notify => Service['nagios'] }
Nagios_contact <<||>> { notify => Service['nagios'] }
Nagios_contactgroup <<||>> { notify => Service['nagios'] }
Nagios_command <<||>> { notify => Service['nagios'] }
Nagios_timeperiod <<||>> { notify => Service['nagios'] }
# collect resources and populate /etc/nagios/conf.d/nagios_*.cfg
Nagios_host <<||>> { notify => Service['nagios'] }
Nagios_hostgroup <<||>> { notify => Service['nagios'] }
Nagios_hostdependency <<||>> { notify => Service['nagios'] }
Nagios_hostescalation <<||>> { notify => Service['nagios'] }
Nagios_hostextinfo <<||>> { notify => Service['nagios'] }
Nagios_service <<||>> { notify => Service['nagios'] }
Nagios_servicegroup <<||>> { notify => Service['nagios'] }
Nagios_servicedependency <<||>> { notify => Service['nagios'] }
Nagios_serviceescalation <<||>> { notify => Service['nagios'] }
Nagios_serviceextinfo <<||>> { notify => Service['nagios'] }
Nagios_contact <<||>> { notify => Service['nagios'] }
Nagios_contactgroup <<||>> { notify => Service['nagios'] }
Nagios_command <<||>> { notify => Service['nagios'] }
Nagios_timeperiod <<||>> { notify => Service['nagios'] }
}
}