diff --git a/README.md b/README.md index 0c11d85..2aee7a7 100644 --- a/README.md +++ b/README.md @@ -38,8 +38,9 @@ CONFIGURATION * manage configuration files through parameters: * nrpe.conf * nrpe.cfg - * commands.cfg (optional) -* manage iptables (optionals ) +* manage dynamic NRPE check command definitions +* manage iptables (optional) +* manage selinux rule exceptions (optional) SERVICE * manage NRPE service @@ -89,6 +90,8 @@ There are currently no mandatory parameters, i.e. the module will function right ### 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. +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: ``` `cd_nrpe::commands::definitions` { 'check_users': diff --git a/manifests/commands/definition_rules.pp b/manifests/commands/definition_rules.pp index d34dc97..9bdaed1 100644 --- a/manifests/commands/definition_rules.pp +++ b/manifests/commands/definition_rules.pp @@ -23,6 +23,7 @@ # cd_nrpe::commands::definitions { 'check_users': # ne_check_cmd => 'check_users', # ne_cmd_argstring => '-w $ARG1$ -c $ARG2$', +# ne_cmd_comment => 'check the amount of user logged in locally', # } ############################################################################### class cd_nrpe::commands::definition_rules ( @@ -59,6 +60,7 @@ class cd_nrpe::commands::definition_rules ( cd_nrpe::commands::definitions { 'check_users': ne_check_cmd => 'check_users', ne_cmd_argstring => '-w $ARG1$ -c $ARG2$', + ne_cmd_comment => 'check the amount of user logged in locally', } cd_nrpe::commands::definitions { 'check_load': diff --git a/manifests/commands/definitions.pp b/manifests/commands/definitions.pp index 0d5856c..01f5940 100644 --- a/manifests/commands/definitions.pp +++ b/manifests/commands/definitions.pp @@ -27,12 +27,15 @@ # @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. +# @param [string] ne_cmd_comment Specify an optional comment for your command +# definition ############################################################################### define cd_nrpe::commands::definitions ( $ne_check_cmd = undef, $ne_cmd_path = '/usr/lib64/nagios/plugins/', $ne_cmd_argstring = undef, +$ne_cmd_comment = undef, ) { diff --git a/templates/cmd_rule.erb b/templates/cmd_rule.erb index bab311b..0b7d5ea 100644 --- a/templates/cmd_rule.erb +++ b/templates/cmd_rule.erb @@ -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 %>