added comment option

This commit is contained in:
Arne Teuke
2017-07-30 13:17:19 +01:00
parent c0a5382d2c
commit ae65987869
4 changed files with 13 additions and 2 deletions

View File

@@ -38,8 +38,9 @@ CONFIGURATION
* manage configuration files through parameters: * manage configuration files through parameters:
* nrpe.conf * nrpe.conf
* nrpe.cfg * nrpe.cfg
* commands.cfg (optional) * manage dynamic NRPE check command definitions
* manage iptables (optionals ) * manage iptables (optional)
* manage selinux rule exceptions (optional)
SERVICE SERVICE
* manage NRPE service * manage NRPE service
@@ -89,6 +90,8 @@ There are currently no mandatory parameters, i.e. the module will function right
### Managing Check Commands ### Managing Check Commands
In order to connect a Nagios monitoring server to clients through NRPE, you must define commands and the desired argument strings on the clients. The default NRPE installation comes with a few examples of such commands, which are also included in this module. However, every environment is very different in their requirements and Nagios via Puppet is all about the ability to dynamicically set command arguments based on default variables / overrides. For that reason no hard-coded commands are included, but instead all commands are set via argument strings, where possible. In order to connect a Nagios monitoring server to clients through NRPE, you must define commands and the desired argument strings on the clients. The default NRPE installation comes with a few examples of such commands, which are also included in this module. However, every environment is very different in their requirements and Nagios via Puppet is all about the ability to dynamicically set command arguments based on default variables / overrides. For that reason no hard-coded commands are included, but instead all commands are set via argument strings, where possible.
The commands are created within /etc/nrpe.d/command.cfg , every set of instructions creates a new line.
Defining commands is as simple as that: Defining commands is as simple as that:
``` ```
`cd_nrpe::commands::definitions` { 'check_users': `cd_nrpe::commands::definitions` { 'check_users':

View File

@@ -23,6 +23,7 @@
# cd_nrpe::commands::definitions { 'check_users': # cd_nrpe::commands::definitions { 'check_users':
# ne_check_cmd => 'check_users', # ne_check_cmd => 'check_users',
# ne_cmd_argstring => '-w $ARG1$ -c $ARG2$', # ne_cmd_argstring => '-w $ARG1$ -c $ARG2$',
# ne_cmd_comment => 'check the amount of user logged in locally',
# } # }
############################################################################### ###############################################################################
class cd_nrpe::commands::definition_rules ( class cd_nrpe::commands::definition_rules (
@@ -59,6 +60,7 @@ class cd_nrpe::commands::definition_rules (
cd_nrpe::commands::definitions { 'check_users': cd_nrpe::commands::definitions { 'check_users':
ne_check_cmd => 'check_users', ne_check_cmd => 'check_users',
ne_cmd_argstring => '-w $ARG1$ -c $ARG2$', ne_cmd_argstring => '-w $ARG1$ -c $ARG2$',
ne_cmd_comment => 'check the amount of user logged in locally',
} }
cd_nrpe::commands::definitions { 'check_load': cd_nrpe::commands::definitions { 'check_load':

View File

@@ -27,12 +27,15 @@
# @param ne_cmd_argstring Specify the string of valid argument for the command # @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 # , i.e. -w $ARG1$ -c $ARG2$. See the arguments in th eman pages for the
# checks. # checks.
# @param [string] ne_cmd_comment Specify an optional comment for your command
# definition
############################################################################### ###############################################################################
define cd_nrpe::commands::definitions ( define cd_nrpe::commands::definitions (
$ne_check_cmd = undef, $ne_check_cmd = undef,
$ne_cmd_path = '/usr/lib64/nagios/plugins/', $ne_cmd_path = '/usr/lib64/nagios/plugins/',
$ne_cmd_argstring = undef, $ne_cmd_argstring = undef,
$ne_cmd_comment = undef,
) { ) {

View File

@@ -1,2 +1,5 @@
<% unless @ne_cmd_comment.empty? -%>
# <%= @ne_cmd_comment %>
<% end -%>
command[<%= @ne_check_cmd %>]=<%= @ne_cmd_path %><%= @ne_check_cmd %> <%= @ne_cmd_argstring %> command[<%= @ne_check_cmd %>]=<%= @ne_cmd_path %><%= @ne_check_cmd %> <%= @ne_cmd_argstring %>