From f4e07050fc41de34cad04bf4037be3c2a4818b9b Mon Sep 17 00:00:00 2001 From: Nick Chappell Date: Sun, 20 Jul 2014 17:35:20 -0700 Subject: [PATCH 1/2] Renamed the icinga2::client class to icinga2::nrpe; this is mainly to accomodate other potential tyes of clients in the future, like NSCA or the Icinga 2 agent. --- README.md | 6 ++--- manifests/client.pp | 12 ++++----- manifests/client/command.pp | 4 +-- manifests/client/config.pp | 6 ++--- manifests/client/install.pp | 22 ++++++++--------- manifests/client/plugin.pp | 4 +-- manifests/client/service.pp | 8 +++--- manifests/nrpe.pp | 24 ++++++++++++++++++ manifests/nrpe/command.pp | 29 ++++++++++++++++++++++ manifests/nrpe/config.pp | 41 +++++++++++++++++++++++++++++++ manifests/nrpe/install.pp | 49 +++++++++++++++++++++++++++++++++++++ manifests/nrpe/plugin.pp | 33 +++++++++++++++++++++++++ manifests/nrpe/service.pp | 20 +++++++++++++++ templates/nrpe.cfg.erb | 18 +++++++------- 14 files changed, 236 insertions(+), 40 deletions(-) create mode 100644 manifests/nrpe.pp create mode 100644 manifests/nrpe/command.pp create mode 100644 manifests/nrpe/config.pp create mode 100644 manifests/nrpe/install.pp create mode 100644 manifests/nrpe/plugin.pp create mode 100644 manifests/nrpe/service.pp diff --git a/README.md b/README.md index fce6f82..7b60bcf 100644 --- a/README.md +++ b/README.md @@ -82,7 +82,7 @@ class { 'icinga2::server': } -**Note:** If you will be installing NRPE or the Nagios plugins packages with the `icinga2::client` class on a node that also has the `icinga2::server` class applied, be sure to set the `$server_install_nagios_plugins` parameter in your call to `icinga2::server` to `false`: +**Note:** If you will be installing NRPE or the Nagios plugins packages with the `icinga2::nrpe` class on a node that also has the `icinga2::server` class applied, be sure to set the `$server_install_nagios_plugins` parameter in your call to `icinga2::server` to `false`:
 #Install Icinga 2:
@@ -93,7 +93,7 @@ class { 'icinga2::server':
  }
 
-This will stop the `icinga2::server` class from trying to install the plugins pacakges, since the `icinga2::client` class will already be installing them and will prevent a resulting duplicate resource error. +This will stop the `icinga2::server` class from trying to install the plugins pacakges, since the `icinga2::nrpe` class will already be installing them and will prevent a resulting duplicate resource error. ####Client usage @@ -116,4 +116,4 @@ class { 'icinga2::server': } -This will stop the `icinga2::server` class from trying to install the plugins pacakges, since the `icinga2::client` class will already be installing them and will prevent a resulting duplicate resource error. \ No newline at end of file +This will stop the `icinga2::server` class from trying to install the plugins pacakges, since the `icinga2::nrpe` class will already be installing them and will prevent a resulting duplicate resource error. \ No newline at end of file diff --git a/manifests/client.pp b/manifests/client.pp index 16229aa..7ff4aae 100644 --- a/manifests/client.pp +++ b/manifests/client.pp @@ -1,10 +1,10 @@ -# Class: icinga2::client +# Class: icinga2::nrpe # # This subclass manages Icinga client components. This class is just the entry point for Puppet to get at the -# icinga2::client:: subclasses. +# icinga2::nrpe:: subclasses. # -class icinga2::client ( +class icinga2::nrpe ( $nrpe_listen_port = $icinga2::params::nrpe_listen_port, $nrpe_debug_level = $icinga2::params::nrpe_debug_level, @@ -18,7 +18,7 @@ class icinga2::client ( #Apply our classes in the right order. Use the squiggly arrows (~>) to ensure that the #class left is applied before the class on the right and that it also refreshes the #class on the right. - class {'icinga2::client::install':} ~> - class {'icinga2::client::config':} ~> - class {'icinga2::client::service':} + class {'icinga2::nrpe::install':} ~> + class {'icinga2::nrpe::config':} ~> + class {'icinga2::nrpe::service':} } diff --git a/manifests/client/command.pp b/manifests/client/command.pp index 104dee5..1faee48 100644 --- a/manifests/client/command.pp +++ b/manifests/client/command.pp @@ -1,4 +1,4 @@ -# Define icinga2::client::command +# Define icinga2::nrpe::command # # This defined type creates NRPE command definitions on machines running NRPE. # @@ -9,7 +9,7 @@ # * $nrpe_plugin_args = The arguments to pass to the plugin. This may be optional, # depending on the plugin and whether it expects any arguments or parameters -define icinga2::client::command ( +define icinga2::nrpe::command ( $command_name = $name, $nrpe_plugin_liddir = $icinga2::params::nrpe_plugin_liddir, $nrpe_plugin_name = undef, diff --git a/manifests/client/config.pp b/manifests/client/config.pp index 19cd2a4..959477d 100644 --- a/manifests/client/config.pp +++ b/manifests/client/config.pp @@ -1,11 +1,11 @@ -# Class: icinga2::client::config +# Class: icinga2::nrpe::config # # This subclass configures Icinga clients. # -class icinga2::client::config inherits icinga2::client { +class icinga2::nrpe::config inherits icinga2::nrpe { - include icinga2::client + include icinga2::nrpe #config resources here diff --git a/manifests/client/install.pp b/manifests/client/install.pp index 6705a3d..f88b430 100644 --- a/manifests/client/install.pp +++ b/manifests/client/install.pp @@ -1,25 +1,25 @@ -# Class: icinga2::client::install +# Class: icinga2::nrpe::install # # This subclass installs NRPE and Nagios plugin packages on Icinga client machines. # -class icinga2::client::install inherits icinga2::client { +class icinga2::nrpe::install inherits icinga2::nrpe { - include icinga2::client + include icinga2::nrpe #Apply our subclasses in the right order. Use the squiggly arrows (~>) to ensure that the #class left is applied before the class on the right and that it also refreshes the #class on the right. - class {'icinga2::client::install::repos':} ~> - class {'icinga2::client::install::packages':} ~> - class {'icinga2::client::install::execs':} + class {'icinga2::nrpe::install::repos':} ~> + class {'icinga2::nrpe::install::packages':} ~> + class {'icinga2::nrpe::install::execs':} } ################## #Package repositories ################## -class icinga2::client::install::repos inherits icinga2::client { +class icinga2::nrpe::install::repos inherits icinga2::nrpe { - include icinga2::client + include icinga2::nrpe #repository resources here } @@ -27,9 +27,9 @@ class icinga2::client::install::repos inherits icinga2::client { ################## # Packages ################## -class icinga2::client::install::packages inherits icinga2::client { +class icinga2::nrpe::install::packages inherits icinga2::nrpe { - include icinga2::client + include icinga2::nrpe #Install the packages we specified in the ::params class: package {$icinga2::params::icinga2_client_packages: ensure => installed, @@ -42,7 +42,7 @@ class icinga2::client::install::packages inherits icinga2::client { ################## # Execs ################## -class icinga2::client::install::execs { +class icinga2::nrpe::install::execs { #exec resources here diff --git a/manifests/client/plugin.pp b/manifests/client/plugin.pp index 0a181e6..5470088 100644 --- a/manifests/client/plugin.pp +++ b/manifests/client/plugin.pp @@ -1,4 +1,4 @@ -# Define icinga2::client::plugin +# Define icinga2::nrpe::plugin # # This defined type distributes . # @@ -14,7 +14,7 @@ # for more info on what formats of URLs you can use to specify which files # you want to distribute. -define icinga2::client::plugin ( +define icinga2::nrpe::plugin ( $plugin_name = $name, $nrpe_plugin_liddir = $icinga2::params::nrpe_plugin_liddir, $source_file = undef, diff --git a/manifests/client/service.pp b/manifests/client/service.pp index bf42782..f4008e0 100644 --- a/manifests/client/service.pp +++ b/manifests/client/service.pp @@ -1,12 +1,12 @@ -# Class: icinga2::client::service +# Class: icinga2::nrpe::service # # This class manges the daemons/services for the server components of Icinga. # # Parameters: -class icinga2::client::service inherits icinga2::client { +class icinga2::nrpe::service inherits icinga2::nrpe { - include icinga2::client + include icinga2::nrpe #Service resource for NRPE. #This references the daemon name we defined in the icinga2::params class based on the OS: @@ -14,7 +14,7 @@ class icinga2::client::service inherits icinga2::client { ensure => running, enable => true, #Enable the service to start on system boot require => Package[$icinga2::params::icinga2_client_packages], - subscribe => Class['icinga2::client::config'], #Subscribe to the client::config class so the service gets restarted if any config files change + subscribe => Class['icinga2::nrpe::config'], #Subscribe to the client::config class so the service gets restarted if any config files change } } \ No newline at end of file diff --git a/manifests/nrpe.pp b/manifests/nrpe.pp new file mode 100644 index 0000000..7ff4aae --- /dev/null +++ b/manifests/nrpe.pp @@ -0,0 +1,24 @@ +# Class: icinga2::nrpe +# +# This subclass manages Icinga client components. This class is just the entry point for Puppet to get at the +# icinga2::nrpe:: subclasses. +# + +class icinga2::nrpe ( + + $nrpe_listen_port = $icinga2::params::nrpe_listen_port, + $nrpe_debug_level = $icinga2::params::nrpe_debug_level, + $nrpe_log_facility = $icinga2::params::nrpe_log_facility, + $nrpe_command_timeout = $icinga2::params::nrpe_command_timeout, + $nrpe_connection_timeout = $icinga2::params::nrpe_connection_timeout, + $nrpe_allowed_hosts = $icinga2::params::nrpe_allowed_hosts + +) inherits icinga2::params { + + #Apply our classes in the right order. Use the squiggly arrows (~>) to ensure that the + #class left is applied before the class on the right and that it also refreshes the + #class on the right. + class {'icinga2::nrpe::install':} ~> + class {'icinga2::nrpe::config':} ~> + class {'icinga2::nrpe::service':} +} diff --git a/manifests/nrpe/command.pp b/manifests/nrpe/command.pp new file mode 100644 index 0000000..1faee48 --- /dev/null +++ b/manifests/nrpe/command.pp @@ -0,0 +1,29 @@ +# Define icinga2::nrpe::command +# +# This defined type creates NRPE command definitions on machines running NRPE. +# +# Parameters: +# * $command_name = What NRPE will know the command as; this defaults to the title of the resource +# * $nrpe_plugin_liddir = The directory where the NRPE plugins themselves live +# * $nrpe_plugin_name = The name of the plugin the command will run +# * $nrpe_plugin_args = The arguments to pass to the plugin. This may be optional, +# depending on the plugin and whether it expects any arguments or parameters + +define icinga2::nrpe::command ( + $command_name = $name, + $nrpe_plugin_liddir = $icinga2::params::nrpe_plugin_liddir, + $nrpe_plugin_name = undef, + $nrpe_plugin_args = undef, +) { + + file { "/etc/nagios/nrpe.d/${command_name}.cfg": + owner => 'root', + group => 'root', + mode => '644', + content => template('icinga2/nrpe_command.cfg.erb'), + require => Package[$icinga2::params::icinga2_client_packages], + notify => Service[$icinga2::params::nrpe_daemon_name] + } + + +} \ No newline at end of file diff --git a/manifests/nrpe/config.pp b/manifests/nrpe/config.pp new file mode 100644 index 0000000..959477d --- /dev/null +++ b/manifests/nrpe/config.pp @@ -0,0 +1,41 @@ +# Class: icinga2::nrpe::config +# +# This subclass configures Icinga clients. +# + +class icinga2::nrpe::config inherits icinga2::nrpe { + + include icinga2::nrpe + + #config resources here + + #The NRPE configuration base directory: + file { $nrpe_config_basedir: + ensure => directory, + owner => 'root', + group => 'root', + mode => '755', + require => Package[$icinga2::params::icinga2_client_packages], + } + + #The folder that will hold our command definition files: + file { '/etc/nagios/nrpe.d': + ensure => directory, + owner => 'root', + group => 'root', + mode => '755', + require => Package[$icinga2::params::icinga2_client_packages], + } + + #File resource for /etc/nagios/nrpe.cfg + file { '/etc/nagios/nrpe.cfg': + path => '/etc/nagios/nrpe.cfg', + ensure => file, + owner => 'root', + group => 'root', + mode => '644', + content => template('icinga2/nrpe.cfg.erb'), + require => Package[$icinga2::params::icinga2_client_packages], + } + +} diff --git a/manifests/nrpe/install.pp b/manifests/nrpe/install.pp new file mode 100644 index 0000000..f88b430 --- /dev/null +++ b/manifests/nrpe/install.pp @@ -0,0 +1,49 @@ +# Class: icinga2::nrpe::install +# +# This subclass installs NRPE and Nagios plugin packages on Icinga client machines. +# + +class icinga2::nrpe::install inherits icinga2::nrpe { + + include icinga2::nrpe + #Apply our subclasses in the right order. Use the squiggly arrows (~>) to ensure that the + #class left is applied before the class on the right and that it also refreshes the + #class on the right. + class {'icinga2::nrpe::install::repos':} ~> + class {'icinga2::nrpe::install::packages':} ~> + class {'icinga2::nrpe::install::execs':} +} + +################## +#Package repositories +################## +class icinga2::nrpe::install::repos inherits icinga2::nrpe { + + include icinga2::nrpe + #repository resources here + +} + +################## +# Packages +################## +class icinga2::nrpe::install::packages inherits icinga2::nrpe { + + include icinga2::nrpe + #Install the packages we specified in the ::params class: + package {$icinga2::params::icinga2_client_packages: + ensure => installed, + provider => $icinga2::params::package_provider, + } + +} + + +################## +# Execs +################## +class icinga2::nrpe::install::execs { + + #exec resources here + +} \ No newline at end of file diff --git a/manifests/nrpe/plugin.pp b/manifests/nrpe/plugin.pp new file mode 100644 index 0000000..5470088 --- /dev/null +++ b/manifests/nrpe/plugin.pp @@ -0,0 +1,33 @@ +# Define icinga2::nrpe::plugin +# +# This defined type distributes . +# +# Parameters: +# * $plugin_name = What Puppet knows this plugin resource as. This is used to create the +# filenameon the client machine in the file resource. By default, it's +# taken from the resource's name +# +# * $nrpe_plugin_liddir = The directory where the NRPE plugins themselves live +# +# * $source_file = The file that will get distributed to Icinga client machines. This can +# be anywhere on your Puppet master. See http://docs.puppetlabs.com/references/3.stable/type.html#file-attribute-source +# for more info on what formats of URLs you can use to specify which files +# you want to distribute. + +define icinga2::nrpe::plugin ( + $plugin_name = $name, + $nrpe_plugin_liddir = $icinga2::params::nrpe_plugin_liddir, + $source_file = undef, +) { + + file { "${nrpe_plugin_liddir}/${plugin_name}": + owner => 'root', + group => 'root', + mode => '755', + source => $source_file, + require => Package[$icinga2::params::icinga2_client_packages], + notify => Service[$icinga2::params::nrpe_daemon_name] + } + + +} \ No newline at end of file diff --git a/manifests/nrpe/service.pp b/manifests/nrpe/service.pp new file mode 100644 index 0000000..f4008e0 --- /dev/null +++ b/manifests/nrpe/service.pp @@ -0,0 +1,20 @@ +# Class: icinga2::nrpe::service +# +# This class manges the daemons/services for the server components of Icinga. +# +# Parameters: + +class icinga2::nrpe::service inherits icinga2::nrpe { + + include icinga2::nrpe + + #Service resource for NRPE. + #This references the daemon name we defined in the icinga2::params class based on the OS: + service {$icinga2::params::nrpe_daemon_name: + ensure => running, + enable => true, #Enable the service to start on system boot + require => Package[$icinga2::params::icinga2_client_packages], + subscribe => Class['icinga2::nrpe::config'], #Subscribe to the client::config class so the service gets restarted if any config files change + } + +} \ No newline at end of file diff --git a/templates/nrpe.cfg.erb b/templates/nrpe.cfg.erb index 45b944d..a409fc1 100644 --- a/templates/nrpe.cfg.erb +++ b/templates/nrpe.cfg.erb @@ -29,7 +29,7 @@ # LOG FACILITY # The syslog facility that should be used for logging purposes. -log_facility=<%= scope.lookupvar('icinga2::client::nrpe_log_facility') %> +log_facility=<%= scope.lookupvar('icinga2::nrpe::nrpe_log_facility') %> @@ -38,7 +38,7 @@ log_facility=<%= scope.lookupvar('icinga2::client::nrpe_log_facility') %> # number. The file is only written if the NRPE daemon is started by the root # user and is running in standalone mode. -pid_file=<%= scope.lookupvar('icinga2::client::nrpe_pid_file_path') %> +pid_file=<%= scope.lookupvar('icinga2::nrpe::nrpe_pid_file_path') %> # PORT NUMBER @@ -46,7 +46,7 @@ pid_file=<%= scope.lookupvar('icinga2::client::nrpe_pid_file_path') %> # NOTE: This must be a non-priviledged port (i.e. > 1024). # NOTE: This option is ignored if NRPE is running under either inetd or xinetd -server_port=<%= scope.lookupvar('icinga2::client::nrpe_listen_port') %> +server_port=<%= scope.lookupvar('icinga2::nrpe::nrpe_listen_port') %> @@ -65,7 +65,7 @@ server_port=<%= scope.lookupvar('icinga2::client::nrpe_listen_port') %> # # NOTE: This option is ignored if NRPE is running under either inetd or xinetd -nrpe_user=<%= scope.lookupvar('icinga2::client::nrpe_user') %> +nrpe_user=<%= scope.lookupvar('icinga2::nrpe::nrpe_user') %> @@ -75,7 +75,7 @@ nrpe_user=<%= scope.lookupvar('icinga2::client::nrpe_user') %> # # NOTE: This option is ignored if NRPE is running under either inetd or xinetd -nrpe_group=<%= scope.lookupvar('icinga2::client::nrpe_group') %> +nrpe_group=<%= scope.lookupvar('icinga2::nrpe::nrpe_group') %> @@ -92,7 +92,7 @@ nrpe_group=<%= scope.lookupvar('icinga2::client::nrpe_group') %> # # NOTE: This option is ignored if NRPE is running under either inetd or xinetd -allowed_hosts=<%= scope.lookupvar('icinga2::client::nrpe_allowed_hosts').join(',') %> +allowed_hosts=<%= scope.lookupvar('icinga2::nrpe::nrpe_allowed_hosts').join(',') %> @@ -138,7 +138,7 @@ dont_blame_nrpe=0 # syslog facility. # Values: 0=debugging off, 1=debugging on -debug=<%= scope.lookupvar('icinga2::client::nrpe_debug_level') %> +debug=<%= scope.lookupvar('icinga2::nrpe::nrpe_debug_level') %> @@ -146,7 +146,7 @@ debug=<%= scope.lookupvar('icinga2::client::nrpe_debug_level') %> # This specifies the maximum number of seconds that the NRPE daemon will # allow plugins to finish executing before killing them off. -command_timeout=<%= scope.lookupvar('icinga2::client::nrpe_command_timeout') %> +command_timeout=<%= scope.lookupvar('icinga2::nrpe::nrpe_command_timeout') %> @@ -157,7 +157,7 @@ command_timeout=<%= scope.lookupvar('icinga2::client::nrpe_command_timeout') %> # all network sessions are connected. This causes the nrpe daemons to # accumulate, eating system resources. Do not set this too low. -connection_timeout=<%= scope.lookupvar('icinga2::client::nrpe_connection_timeout') %> +connection_timeout=<%= scope.lookupvar('icinga2::nrpe::nrpe_connection_timeout') %> From bdf994929fd10efd85fb99060fc894b4e5303d55 Mon Sep 17 00:00:00 2001 From: Nick Chappell Date: Sun, 20 Jul 2014 17:37:57 -0700 Subject: [PATCH 2/2] Deleted the duplicate client.pp and client/ directories. --- manifests/client.pp | 24 ------------------ manifests/client/command.pp | 29 ---------------------- manifests/client/config.pp | 41 ------------------------------- manifests/client/install.pp | 49 ------------------------------------- manifests/client/plugin.pp | 33 ------------------------- manifests/client/service.pp | 20 --------------- 6 files changed, 196 deletions(-) delete mode 100644 manifests/client.pp delete mode 100644 manifests/client/command.pp delete mode 100644 manifests/client/config.pp delete mode 100644 manifests/client/install.pp delete mode 100644 manifests/client/plugin.pp delete mode 100644 manifests/client/service.pp diff --git a/manifests/client.pp b/manifests/client.pp deleted file mode 100644 index 7ff4aae..0000000 --- a/manifests/client.pp +++ /dev/null @@ -1,24 +0,0 @@ -# Class: icinga2::nrpe -# -# This subclass manages Icinga client components. This class is just the entry point for Puppet to get at the -# icinga2::nrpe:: subclasses. -# - -class icinga2::nrpe ( - - $nrpe_listen_port = $icinga2::params::nrpe_listen_port, - $nrpe_debug_level = $icinga2::params::nrpe_debug_level, - $nrpe_log_facility = $icinga2::params::nrpe_log_facility, - $nrpe_command_timeout = $icinga2::params::nrpe_command_timeout, - $nrpe_connection_timeout = $icinga2::params::nrpe_connection_timeout, - $nrpe_allowed_hosts = $icinga2::params::nrpe_allowed_hosts - -) inherits icinga2::params { - - #Apply our classes in the right order. Use the squiggly arrows (~>) to ensure that the - #class left is applied before the class on the right and that it also refreshes the - #class on the right. - class {'icinga2::nrpe::install':} ~> - class {'icinga2::nrpe::config':} ~> - class {'icinga2::nrpe::service':} -} diff --git a/manifests/client/command.pp b/manifests/client/command.pp deleted file mode 100644 index 1faee48..0000000 --- a/manifests/client/command.pp +++ /dev/null @@ -1,29 +0,0 @@ -# Define icinga2::nrpe::command -# -# This defined type creates NRPE command definitions on machines running NRPE. -# -# Parameters: -# * $command_name = What NRPE will know the command as; this defaults to the title of the resource -# * $nrpe_plugin_liddir = The directory where the NRPE plugins themselves live -# * $nrpe_plugin_name = The name of the plugin the command will run -# * $nrpe_plugin_args = The arguments to pass to the plugin. This may be optional, -# depending on the plugin and whether it expects any arguments or parameters - -define icinga2::nrpe::command ( - $command_name = $name, - $nrpe_plugin_liddir = $icinga2::params::nrpe_plugin_liddir, - $nrpe_plugin_name = undef, - $nrpe_plugin_args = undef, -) { - - file { "/etc/nagios/nrpe.d/${command_name}.cfg": - owner => 'root', - group => 'root', - mode => '644', - content => template('icinga2/nrpe_command.cfg.erb'), - require => Package[$icinga2::params::icinga2_client_packages], - notify => Service[$icinga2::params::nrpe_daemon_name] - } - - -} \ No newline at end of file diff --git a/manifests/client/config.pp b/manifests/client/config.pp deleted file mode 100644 index 959477d..0000000 --- a/manifests/client/config.pp +++ /dev/null @@ -1,41 +0,0 @@ -# Class: icinga2::nrpe::config -# -# This subclass configures Icinga clients. -# - -class icinga2::nrpe::config inherits icinga2::nrpe { - - include icinga2::nrpe - - #config resources here - - #The NRPE configuration base directory: - file { $nrpe_config_basedir: - ensure => directory, - owner => 'root', - group => 'root', - mode => '755', - require => Package[$icinga2::params::icinga2_client_packages], - } - - #The folder that will hold our command definition files: - file { '/etc/nagios/nrpe.d': - ensure => directory, - owner => 'root', - group => 'root', - mode => '755', - require => Package[$icinga2::params::icinga2_client_packages], - } - - #File resource for /etc/nagios/nrpe.cfg - file { '/etc/nagios/nrpe.cfg': - path => '/etc/nagios/nrpe.cfg', - ensure => file, - owner => 'root', - group => 'root', - mode => '644', - content => template('icinga2/nrpe.cfg.erb'), - require => Package[$icinga2::params::icinga2_client_packages], - } - -} diff --git a/manifests/client/install.pp b/manifests/client/install.pp deleted file mode 100644 index f88b430..0000000 --- a/manifests/client/install.pp +++ /dev/null @@ -1,49 +0,0 @@ -# Class: icinga2::nrpe::install -# -# This subclass installs NRPE and Nagios plugin packages on Icinga client machines. -# - -class icinga2::nrpe::install inherits icinga2::nrpe { - - include icinga2::nrpe - #Apply our subclasses in the right order. Use the squiggly arrows (~>) to ensure that the - #class left is applied before the class on the right and that it also refreshes the - #class on the right. - class {'icinga2::nrpe::install::repos':} ~> - class {'icinga2::nrpe::install::packages':} ~> - class {'icinga2::nrpe::install::execs':} -} - -################## -#Package repositories -################## -class icinga2::nrpe::install::repos inherits icinga2::nrpe { - - include icinga2::nrpe - #repository resources here - -} - -################## -# Packages -################## -class icinga2::nrpe::install::packages inherits icinga2::nrpe { - - include icinga2::nrpe - #Install the packages we specified in the ::params class: - package {$icinga2::params::icinga2_client_packages: - ensure => installed, - provider => $icinga2::params::package_provider, - } - -} - - -################## -# Execs -################## -class icinga2::nrpe::install::execs { - - #exec resources here - -} \ No newline at end of file diff --git a/manifests/client/plugin.pp b/manifests/client/plugin.pp deleted file mode 100644 index 5470088..0000000 --- a/manifests/client/plugin.pp +++ /dev/null @@ -1,33 +0,0 @@ -# Define icinga2::nrpe::plugin -# -# This defined type distributes . -# -# Parameters: -# * $plugin_name = What Puppet knows this plugin resource as. This is used to create the -# filenameon the client machine in the file resource. By default, it's -# taken from the resource's name -# -# * $nrpe_plugin_liddir = The directory where the NRPE plugins themselves live -# -# * $source_file = The file that will get distributed to Icinga client machines. This can -# be anywhere on your Puppet master. See http://docs.puppetlabs.com/references/3.stable/type.html#file-attribute-source -# for more info on what formats of URLs you can use to specify which files -# you want to distribute. - -define icinga2::nrpe::plugin ( - $plugin_name = $name, - $nrpe_plugin_liddir = $icinga2::params::nrpe_plugin_liddir, - $source_file = undef, -) { - - file { "${nrpe_plugin_liddir}/${plugin_name}": - owner => 'root', - group => 'root', - mode => '755', - source => $source_file, - require => Package[$icinga2::params::icinga2_client_packages], - notify => Service[$icinga2::params::nrpe_daemon_name] - } - - -} \ No newline at end of file diff --git a/manifests/client/service.pp b/manifests/client/service.pp deleted file mode 100644 index f4008e0..0000000 --- a/manifests/client/service.pp +++ /dev/null @@ -1,20 +0,0 @@ -# Class: icinga2::nrpe::service -# -# This class manges the daemons/services for the server components of Icinga. -# -# Parameters: - -class icinga2::nrpe::service inherits icinga2::nrpe { - - include icinga2::nrpe - - #Service resource for NRPE. - #This references the daemon name we defined in the icinga2::params class based on the OS: - service {$icinga2::params::nrpe_daemon_name: - ensure => running, - enable => true, #Enable the service to start on system boot - require => Package[$icinga2::params::icinga2_client_packages], - subscribe => Class['icinga2::nrpe::config'], #Subscribe to the client::config class so the service gets restarted if any config files change - } - -} \ No newline at end of file