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.
This commit is contained in:
parent
8d10c5c871
commit
f4e07050fc
14 changed files with 236 additions and 40 deletions
|
@ -82,7 +82,7 @@ class { 'icinga2::server':
|
|||
}
|
||||
</pre>
|
||||
|
||||
**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`:
|
||||
|
||||
<pre>
|
||||
#Install Icinga 2:
|
||||
|
@ -93,7 +93,7 @@ class { 'icinga2::server':
|
|||
}
|
||||
</pre>
|
||||
|
||||
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':
|
|||
}
|
||||
</pre>
|
||||
|
||||
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.
|
|
@ -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':}
|
||||
}
|
||||
|
|
|
@ -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,
|
||||
|
|
|
@ -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
|
||||
|
||||
|
|
|
@ -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
|
||||
|
||||
|
|
|
@ -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,
|
||||
|
|
|
@ -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
|
||||
}
|
||||
|
||||
}
|
24
manifests/nrpe.pp
Normal file
24
manifests/nrpe.pp
Normal file
|
@ -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':}
|
||||
}
|
29
manifests/nrpe/command.pp
Normal file
29
manifests/nrpe/command.pp
Normal file
|
@ -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]
|
||||
}
|
||||
|
||||
|
||||
}
|
41
manifests/nrpe/config.pp
Normal file
41
manifests/nrpe/config.pp
Normal file
|
@ -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],
|
||||
}
|
||||
|
||||
}
|
49
manifests/nrpe/install.pp
Normal file
49
manifests/nrpe/install.pp
Normal file
|
@ -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
|
||||
|
||||
}
|
33
manifests/nrpe/plugin.pp
Normal file
33
manifests/nrpe/plugin.pp
Normal file
|
@ -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]
|
||||
}
|
||||
|
||||
|
||||
}
|
20
manifests/nrpe/service.pp
Normal file
20
manifests/nrpe/service.pp
Normal file
|
@ -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
|
||||
}
|
||||
|
||||
}
|
|
@ -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') %>
|
||||
|
||||
|
||||
|
||||
|
|
Loading…
Reference in a new issue