updated README, added defintions

This commit is contained in:
Arne Teuke
2017-07-30 12:32:29 +01:00
parent 93c4d60d23
commit d9e6db5e0d
7 changed files with 105 additions and 2 deletions

View File

@@ -0,0 +1,56 @@
## cd_nrpe::commands::definition_rules.pp
# Module name: cd_nrpe
# Author: Arne Teuke (arne_teuke@ConfDroid.com)
# # License:
# This file is part of cd_nrpe.
#
# cd_nrpe is used for providing automatic configuration of NRPE.
# 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 manage command definitions via define and Puppet rules.
###############################################################################
class cd_nrpe::commands::definitions (
) inherits cd_nrpe::params {
if $ne_manage_cmds == true {
# manage the commands.cfg file
concat { $ne_cmd_file:
ensure => present,
path => $ne_cmd_file,
owner => 'root',
group => 'root',
mode => '0640',
selrange => s0,
selrole => object_r,
seltype => nrpe_etc_t,
seluser => system_u,
notify => Service[$ne_service],
}
# manage the file header
concat::fragment { 'nrpe_cmd_header':
target => $ne_cmd_file,
content => template($ne_cmd_head_erb),
order => '000',
}
# basic example rules
}
}

View File

@@ -18,13 +18,30 @@
#
# 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
# @summary Populate command definitions through external puppet rules, i.e.
# from other modules.
# @param [string] ne_check_cmd Specify the check_command to use.
# @param [string] ne_cmd_path The path to the command scripts, usually
# where the nagis_plugins are located. If you use your own scripts, specify
# the custom location **__including the trailing slash__**
# @param ne_cmd_argstring Specify the string of valid argument for the command
# , i.e. -w $ARG1$ -c $ARG2$. See the arguments in th eman pages for the
# checks.
###############################################################################
define cd_nrpe::commands::definitions (
$ne_check_cmd = undef,
$ne_cmd_path = '/usr/lib64/nagios/plugins/',
$ne_cmd_argstring = undef,
) {
$ne_cmd_file = $::cd_nrpe::params::ne_cmd_file
$ne_cmd_rule_erb = $::cd_nrpe::params::ne_cmd_rule_erb
concat::fragment { $name:
target => $ne_cmd_file,
content => template($ne_cmd_rule_erb),
}
}

View File

@@ -30,6 +30,10 @@ class cd_nrpe::main::service (
require cd_nrpe::main::files
if $ne_manage_cmds == true {
require cd_nrpe::commands::definition_rules
}
service { $ne_service:
ensure => running,
hasstatus => true,

View File

@@ -95,11 +95,15 @@
# @param [string] ne_allow_weak_rnd_seed Whether to allow weak random seeds
# @param [string] ne_include_selinux Whether to manage selinux
# @param [boolean] ne_enable_ssl Whether to enable SSL certificates.
# @param [boolean] ne_manage_cmds Whether to manage command rules for NRPE
# checks, to allow dynamic check & command rules.
###############################################################################
class cd_nrpe::params (
$pkg_ensure = 'latest',
$ne_manage_cmds = true,
# user settings
$ne_user = 'nrpe',
$ne_user_comment = 'NRPE service user',
@@ -166,6 +170,9 @@ $ne_main_conf_erb = 'cd_nrpe/nrpe_cfg.erb'
$ne_nrpe_pid_file = "${ne_run_dir}/nrpe.pid"
$ne_nrpe_conf_file = '/etc/sysconfig/nrpe'
$ne_nrpe_conf_erb = 'cd_nrpe/nrpe_conf.erb'
$ne_cmd_file = "${ne_main_conf_d_dir}/commands.cfg"
$ne_cmd_head_erb = 'cd_nrpe/cmd_head.erb'
$ne_cmd_rule_erb = 'cd_nrpe/cmd_rule.erb'
# includes must be last