centos support

This commit is contained in:
Ivan Ponovarev 2013-02-01 19:02:11 +04:00
parent 5780cdd109
commit 79122eec1e
26 changed files with 435 additions and 179 deletions

View File

@ -0,0 +1,228 @@
#
# THIS FILE IS MANAGED BY PUPPET
# <%= file %>
#
#############################################################################
# Sample NRPE Config File
# Written by: Ethan Galstad (nagios@nagios.org)
#
#
# NOTES:
# This is a sample configuration file for the NRPE daemon. It needs to be
# located on the remote host that is running the NRPE daemon, not the host
# from which the check_nrpe client is being executed.
#############################################################################
# LOG FACILITY
# The syslog facility that should be used for logging purposes.
log_facility=daemon
# PID FILE
# The name of the file in which the NRPE daemon should write it's process ID
# number. The file is only written if the NRPE daemon is started by the root
# user and is running in standalone mode.
pid_file=/var/run/nagios/nrpe.pid
# PORT NUMBER
# Port number we should wait for connections on.
# 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=5666
# SERVER ADDRESS
# Address that nrpe should bind to in case there are more than one interface
# and you do not want nrpe to bind on all interfaces.
# NOTE: This option is ignored if NRPE is running under either inetd or xinetd
#server_address=127.0.0.1
# NRPE USER
# This determines the effective user that the NRPE daemon should run as.
# You can either supply a username or a UID.
#
# NOTE: This option is ignored if NRPE is running under either inetd or xinetd
nrpe_user=nagios
# NRPE GROUP
# This determines the effective group that the NRPE daemon should run as.
# You can either supply a group name or a GID.
#
# NOTE: This option is ignored if NRPE is running under either inetd or xinetd
nrpe_group=nagios
# ALLOWED HOST ADDRESSES
# This is an optional comma-delimited list of IP address or hostnames
# that are allowed to talk to the NRPE daemon.
#
# Note: The daemon only does rudimentary checking of the client's IP
# address. I would highly recommend adding entries in your /etc/hosts.allow
# file to allow only the specified host to connect to the port
# you are running this daemon on.
#
# NOTE: This option is ignored if NRPE is running under either inetd or xinetd
<% if whitelist.kind_of?(Array) -%>
allowed_hosts=<%= whitelist.join(",") %>
<% else -%>
allowed_hosts=<%= whitelist %>
<% end -%>
# COMMAND ARGUMENT PROCESSING
# This option determines whether or not the NRPE daemon will allow clients
# to specify arguments to commands that are executed. This option only works
# if the daemon was configured with the --enable-command-args configure script
# option.
#
# *** ENABLING THIS OPTION IS A SECURITY RISK! ***
# Read the SECURITY file for information on some of the security implications
# of enabling this variable.
#
# Values: 0=do not allow arguments, 1=allow command arguments
dont_blame_nrpe=1
# COMMAND PREFIX
# This option allows you to prefix all commands with a user-defined string.
# A space is automatically added between the specified prefix string and the
# command line from the command definition.
#
# *** THIS EXAMPLE MAY POSE A POTENTIAL SECURITY RISK, SO USE WITH CAUTION! ***
# Usage scenario:
# Execute restricted commmands using sudo. For this to work, you need to add
# the nagios user to your /etc/sudoers. An example entry for alllowing
# execution of the plugins from might be:
#
# nagios ALL=(ALL) NOPASSWD: /usr/lib/nagios/plugins/
#
# This lets the nagios user run all commands in that directory (and only them)
# without asking for a password. If you do this, make sure you don't give
# random users write access to that directory or its contents!
# command_prefix=/usr/bin/sudo
# DEBUGGING OPTION
# This option determines whether or not debugging messages are logged to the
# syslog facility.
# Values: 0=debugging off, 1=debugging on
debug=0
# COMMAND TIMEOUT
# This specifies the maximum number of seconds that the NRPE daemon will
# allow plugins to finish executing before killing them off.
command_timeout=60
# CONNECTION TIMEOUT
# This specifies the maximum number of seconds that the NRPE daemon will
# wait for a connection to be established before exiting. This is sometimes
# seen where a network problem stops the SSL being established even though
# all network sessions are connected. This causes the nrpe daemons to
# accumulate, eating system resources. Do not set this too low.
connection_timeout=300
# WEEK RANDOM SEED OPTION
# This directive allows you to use SSL even if your system does not have
# a /dev/random or /dev/urandom (on purpose or because the necessary patches
# were not applied). The random number generator will be seeded from a file
# which is either a file pointed to by the environment valiable $RANDFILE
# or $HOME/.rnd. If neither exists, the pseudo random number generator will
# be initialized and a warning will be issued.
# Values: 0=only seed from /dev/[u]random, 1=also seed from weak randomness
#allow_weak_random_seed=1
# INCLUDE CONFIG FILE
# This directive allows you to include definitions from an external config file.
#include=<somefile.cfg>
# INCLUDE CONFIG DIRECTORY
# This directive allows you to include definitions from config files (with a
# .cfg extension) in one or more directories (with recursion).
#include_dir=<somedirectory>
#include_dir=<someotherdirectory>
include_dir=<%= include_dir %>
# COMMAND DEFINITIONS
# Command definitions that this daemon will run. Definitions
# are in the following format:
#
# command[<command_name>]=<command_line>
#
# When the daemon receives a request to return the results of <command_name>
# it will execute the command specified by the <command_line> argument.
#
# Unlike Nagios, the command line cannot contain macros - it must be
# typed exactly as it should be executed.
#
# Note: Any plugins that are used in the command lines must reside
# on the machine that this daemon is running on! The examples below
# assume that you have plugins installed in a /usr/local/nagios/libexec
# directory. Also note that you will have to modify the definitions below
# to match the argument format the plugins expect. Remember, these are
# examples only!
# The following examples use hardcoded command arguments...
#command[check_users]=/usr/lib/nagios/plugins/check_users -w 5 -c 10
#command[check_load]=/usr/lib/nagios/plugins/check_load -w 15,10,5 -c 30,25,20
#command[check_hda1]=/usr/lib/nagios/plugins/check_disk -w 20% -c 10% -p /dev/hda1
#command[check_zombie_procs]=/usr/lib/nagios/plugins/check_procs -w 5 -c 10 -s Z
#command[check_total_procs]=/usr/lib/nagios/plugins/check_procs -w 150 -c 200
# The following examples allow user-supplied arguments and can
# only be used if the NRPE daemon was compiled with support for
# command arguments *AND* the dont_blame_nrpe directive in this
# config file is set to '1'. This poses a potential security risk, so
# make sure you read the SECURITY file before doing this.
#command[check_users]=/usr/lib/nagios/plugins/check_users -w $ARG1$ -c $ARG2$
#command[check_load]=/usr/lib/nagios/plugins/check_load -w $ARG1$ -c $ARG2$
#command[check_disk]=/usr/lib/nagios/plugins/check_disk -w $ARG1$ -c $ARG2$ -p $ARG3$
#command[check_procs]=/usr/lib/nagios/plugins/check_procs -w $ARG1$ -c $ARG2$ -s $ARG3$
#
# local configuration:
# if you'd prefer, you can instead place directives here
include=/etc/nagios/nrpe_local.cfg

View File

@ -3,4 +3,4 @@
# /etc/puppet/modules/production/nagios/files/common/etc/nagios/nrpe.d/disk.cfg # /etc/puppet/modules/production/nagios/files/common/etc/nagios/nrpe.d/disk.cfg
# #
command[check_disk]=/usr/lib/nagios/plugins/check_disk -w $ARG1$ -c $ARG2$ -p $ARG3$ command[check_disk]=/usr/lib64/nagios/plugins/check_disk -w $ARG1$ -c $ARG2$ -p $ARG3$

View File

@ -1,6 +0,0 @@
#
# THIS FILE IS MANAGED BY PUPPET
# /etc/puppet/modules/production/nagios/files/common/etc/nagios/nrpe.d/load.cfg
#
command[check_load]=/usr/lib/nagios/plugins/check_load -w $ARG1$,$ARG2$,$ARG3$ -c $ARG4$,$ARG5$,$ARG6$

View File

@ -1,6 +0,0 @@
#
# THIS FILE IS MANAGED BY PUPPET
# /etc/puppet/modules/production/nagios/files/common/etc/nagios/nrpe.d/mailq.cfg
#
command[check_mailq]=/usr/lib/nagios/plugins/check_mailq -w $ARG1$ -c $ARG2$

View File

@ -1,17 +0,0 @@
command[check_nova_compute]=/usr/lib/nagios/plugins/check_procs -c 1:10 -C nova-compute
command[check_nova_network]=/usr/lib/nagios/plugins/check_procs -c 1:10 -C nova-network
command[check_nova_scheduler]=/usr/lib/nagios/plugins/check_procs -c 1:10 -C nova-scheduler
command[check_nova_consoleauth]=/usr/lib/nagios/plugins/check_procs -c 1:10 -a nova-consoleauth
command[check_nova_cert]=/usr/lib/nagios/plugins/check_procs -c 1:10 -C nova-cert
command[check_cinder_scheduler]=/usr/lib/nagios/plugins/check_procs -c 1:10 -a cinder-scheduler
command[check_cinder_volume]=/usr/lib/nagios/plugins/check_procs -c 1:10 -C cinder-volume
command[check_haproxy]=/usr/lib/nagios/plugins/check_procs -c 1:10 -C haproxy
command[check_memcached]=/usr/lib/nagios/plugins/check_procs -c 1:10 -C memcached
command[check_glance_registry]=/usr/lib/nagios/plugins/check_procs -c 1:10 -C glance-registry
command[check_nova_novncproxy]=/usr/lib/nagios/plugins/check_procs -c 1:10 -a nova-novncproxy
command[check_swift_proxy]=/usr/lib/nagios/plugins/check_procs -c 1:10 -a swift-proxy-server
command[check_swift_account]=/usr/lib/nagios/plugins/check_procs -c 1:10 -a swift-account-server
command[check_swift_object]=/usr/lib/nagios/plugins/check_procs -c 1:10 -a swift-object-server
command[check_swift_container]=/usr/lib/nagios/plugins/check_procs -c 1:10 -a swift-container-server
command[check_swift_ring]=/usr/lib/nagios/plugins/check_os_swiftrecon objmd5
command[check_libvirt]=/usr/lib/nagios/plugins/check_os_libvirt connect -H 127.0.0.1 -m qemu+tcp

View File

@ -1,7 +0,0 @@
#
# THIS FILE IS MANAGED BY PUPPET
# /etc/puppet/modules/production/nagios/files/common/etc/nagios/nrpe.d/procs.cfg
#
command[check_procs]=/usr/lib/nagios/plugins/check_procs -w $ARG1$ -c $ARG2$
command[check_procs_zombie]=/usr/lib/nagios/plugins/check_procs -w $ARG1$ -c $ARG2$ -s Z

View File

@ -1,6 +0,0 @@
#
# THIS FILE IS MANAGED BY PUPPET
# /etc/puppet/modules/production/nagios/files/common/etc/nagios/nrpe.d/smart.cfg
#
command[check_ide_smart]=sudo /usr/lib/nagios/plugins/check_ide_smart -d $ARG1$ -n

View File

@ -1,6 +0,0 @@
#
# THIS FILE IS MANAGED BY PUPPET
# /etc/puppet/modules/production/nagios/files/common/etc/nagios/nrpe.d/swap.cfg
#
command[check_swap]=/usr/lib/nagios/plugins/check_swap -w $ARG1$ -c $ARG2$

View File

@ -1,6 +0,0 @@
#
# THIS FILE IS MANAGED BY PUPPET
# /etc/puppet/modules/production/nagios/files/common/etc/nagios/nrpe.d/users.cfg
#
command[check_users]=/usr/lib/nagios/plugins/check_users -w $ARG1$ -c $ARG2$

View File

@ -4,6 +4,15 @@ class nagios::command inherits nagios::master {
command => '$USER1$/check_ntp_time -H $HOSTADDRESS$', command => '$USER1$/check_ntp_time -H $HOSTADDRESS$',
} }
if $::osfamily == 'RedHat' {
nagios::command::commands {
'check_nrpe':
command => '/usr/lib64/nagios/plugins/check_nrpe -H $HOSTADDRESS$ -c $ARG1$ -a $ARG2$';
'check_nrpe_1arg':
command => '/usr/lib64/nagios/plugins/check_nrpe -H $HOSTADDRESS$ -c $ARG1$';
}
}
# Remote # Remote
nagios::command::commands { 'check_http_api': nagios::command::commands { 'check_http_api':

View File

@ -3,6 +3,6 @@ define nagios::command::commands( $command = false ) {
@@nagios_command { $name: @@nagios_command { $name:
ensure => present, ensure => present,
command_line => $command, command_line => $command,
target => "/etc/nagios3/${proj_name}/commands.cfg", target => "/etc/${nagios::params::masterdir}/${proj_name}/commands.cfg",
} }
} }

View File

@ -6,6 +6,6 @@ notify {$name:}
nagios_contactgroup { $name: nagios_contactgroup { $name:
ensure => present, ensure => present,
alias => $alias, alias => $alias,
target => "/etc/nagios3/${proj_name}/contactgroups.cfg", target => "/etc/${nagios::params::masterdir}/${proj_name}/contactgroups.cfg",
} }
} }

View File

@ -15,6 +15,6 @@ $group = false,
email => $t_email, email => $t_email,
contactgroups => $group, contactgroups => $group,
use => 'generic-contact', use => 'generic-contact',
target => "/etc/nagios3/${proj_name}/contacts.cfg", target => "/etc/${nagios::params::masterdir}/${proj_name}/contacts.cfg",
} }
} }

View File

@ -1,15 +1,13 @@
define nagios::host::hostextinfo() { define nagios::host::hostextinfo() {
$distro = inline_template("<%= scope.lookupvar('::lsbdistid').downcase -%>")
@@nagios_hostextinfo { $name: @@nagios_hostextinfo { $name:
ensure => present, ensure => present,
host_name => $::fqdn, host_name => $::fqdn,
notes => $::lsbdistid, notes => $::lsbdistid,
icon_image => "base/${distro}.png", icon_image => "base/${nagios::params::distro}.png",
icon_image_alt => $::lsbdistid, icon_image_alt => $::lsbdistid,
statusmap_image => "base/${distro}.gd2", statusmap_image => "base/${nagios::params::distro}.gd2",
vrml_image => "${distro}.png", vrml_image => "${nagios::params::distro}.png",
target => "/etc/nagios3/${proj_name}/${::hostname}_hostextinfo.cfg", target => "/etc/${nagios::params::masterdir}/${proj_name}/${::hostname}_hostextinfo.cfg",
} }
} }

View File

@ -5,6 +5,6 @@ define nagios::host::hostgroups() {
nagios_hostgroup { $name: nagios_hostgroup { $name:
ensure => present, ensure => present,
alias => $alias, alias => $alias,
target => "/etc/nagios3/${proj_name}/hostgroups.cfg", target => "/etc/${nagios::params::masterdir}/${proj_name}/hostgroups.cfg",
} }
} }

View File

@ -7,6 +7,6 @@ define nagios::host::hosts() {
use => 'default-host', use => 'default-host',
address => $::fqdn, address => $::fqdn,
host_name => $::fqdn, host_name => $::fqdn,
target => "/etc/nagios3/${proj_name}/${::hostname}_hosts.cfg", target => "/etc/${nagios::params::masterdir}/${proj_name}/${::hostname}_hosts.cfg",
} }
} }

View File

@ -22,38 +22,43 @@ $whitelist = '127.0.0.1',
include_dir => "/etc/nagios/${proj_name}", include_dir => "/etc/nagios/${proj_name}",
} }
file { "/etc/nagios/${proj_name}": package { $nagios::params::nrpepkg:
ensure => present,
}
File {
force => true, force => true,
purge => true, purge => true,
recurse => true, recurse => true,
owner => root, owner => root,
group => root, group => root,
mode => '0644', mode => '0644',
notify => Service['nagios-nrpe-server'],
source => 'puppet:///modules/nagios/common/etc/nagios/nrpe.d',
require => Package['nagios-nrpe-server'],
} }
file { '/usr/local/lib/nagios': file { "/etc/nagios/${proj_name}/openstack.cfg":
force => true, content => template('nagios/openstack/openstack.cfg.erb'),
purge => true, notify => Service[$nagios::params::nrpeservice],
recurse => true, require => Package[$nagios::params::nrpepkg],
owner => root, }
group => staff,
file { "/etc/nagios/${proj_name}/commands.cfg":
content => template('nagios/common/etc/nagios/nrpe.d/commands.cfg.erb'),
notify => Service[$nagios::params::nrpeservice],
require => Package[$nagios::params::nrpepkg],
}
file { "/etc/nagios/${proj_name}":
source => 'puppet:///modules/nagios/common/etc/nagios/nrpe.d',
notify => Service[$nagios::params::nrpeservice],
require => Package[$nagios::params::nrpepkg],
}
file { "/usr/local/lib/nagios":
mode => '0755', mode => '0755',
source => 'puppet:///modules/nagios/common/usr/local/lib/nagios', source => 'puppet:///modules/nagios/common/usr/local/lib/nagios',
} }
package { [ service {$nagios::params::nrpeservice:
'binutils',
'libnagios-plugin-perl',
'nagios-nrpe-server',
'nagios-plugins-basic',
'nagios-plugins-standard' ]:
ensure => present,
}
service { 'nagios-nrpe-server':
ensure => running, ensure => running,
enable => true, enable => true,
hasrestart => true, hasrestart => true,
@ -61,7 +66,7 @@ $whitelist = '127.0.0.1',
pattern => 'nrpe', pattern => 'nrpe',
require => [ require => [
File['nrpe.cfg'], File['nrpe.cfg'],
Package['nagios-nrpe-server'] Package[$nagios::params::nrpepkg]
], ],
} }
} }

View File

@ -23,7 +23,7 @@ $contactgroups = {'group' => 'admins', 'alias' => 'Admins'},
$contacts = {'user' => 'hotkey', 'alias' => 'Dennis Hoppe', $contacts = {'user' => 'hotkey', 'alias' => 'Dennis Hoppe',
'email' => 'nagios@%{domain}', 'email' => 'nagios@%{domain}',
'group' => 'admins'}, 'group' => 'admins'},
) { ) inherits nagios::params {
validate_hash($htpasswd) validate_hash($htpasswd)
validate_hash($templateservice) validate_hash($templateservice)
@ -36,104 +36,96 @@ $contacts = {'user' => 'hotkey', 'alias' => 'Dennis Hoppe',
include nagios::command include nagios::command
include nagios::contact include nagios::contact
exec { 'external-commands': if $::osfamily == 'Debian' {
command => 'dpkg-statoverride --update --add nagios nagios 751 /var/lib/nagios3 && dpkg-statoverride --update --add nagios www-data 2710 /var/lib/nagios3/rw', exec { 'external-commands':
path => ['/bin','/sbin','/usr/sbin/','/usr/sbin/'], command => 'dpkg-statoverride --update --add nagios nagios 751 /var/lib/nagios3 && dpkg-statoverride --update --add nagios www-data 2710 /var/lib/nagios3/rw',
unless => 'dpkg-statoverride --list nagios nagios 751 /var/lib/nagios3 && dpkg-statoverride --list nagios www-data 2710 /var/lib/nagios3/rw', path => ['/bin','/sbin','/usr/sbin/','/usr/sbin/'],
notify => Service['nagios3'], unless => 'dpkg-statoverride --list nagios nagios 751 /var/lib/nagios3 && dpkg-statoverride --list nagios www-data 2710 /var/lib/nagios3/rw',
notify => Service[$nagios::params::masterservice],
}
} }
# Bug: 3299 # Bug: 3299
exec { 'fix-permissions': exec { 'fix-permissions':
command => "chmod -R go+r /etc/nagios3/${proj_name}", command => "chmod -R go+r /etc/${nagios::params::masterdir}/${proj_name}",
path => ['/bin','/sbin','/usr/sbin/','/usr/sbin/'], path => ['/bin','/sbin','/usr/sbin/','/usr/sbin/'],
refreshonly => true, refreshonly => true,
notify => Service['nagios3'], notify => Service[$nagios::params::masterservice],
} }
package { $nagios::params::nagios3pkg:
augeas {'configs':
context => '/files/etc/nagios3/nagios.cfg',
changes => [
"set cfg_dir[2] \"/etc/nagios3/${proj_name}\"",
'set check_external_commands 1',
],
}
file { '/etc/nagios3/htpasswd.users':
owner => root,
group => root,
mode => '0644',
content => template('nagios/common/etc/nagios3/htpasswd.users.erb'),
require => Package['nagios3'],
}
file { "/etc/nagios3/${proj_name}/templates.cfg":
owner => root,
group => root,
mode => '0644',
content => template('nagios/openstack/templates.cfg.erb'),
require => Package['nagios3'],
}
file { "/etc/nagios3/${proj_name}/hostgroup.cfg":
owner => root,
group => root,
mode => '0644',
content => template('nagios/openstack/hostgroups.cfg.erb'),
require => Package['nagios3'],
}
file { "/etc/nagios3/${proj_name}":
recurse => true,
owner => root,
group => root,
mode => '0644',
alias => 'conf.d',
notify => Service['nagios3'],
source => 'puppet:///modules/nagios/common/etc/nagios3/conf.d',
require => Package['nagios3'],
}
package { [
'nagios3',
'nagios-nrpe-plugin' ]:
ensure => present, ensure => present,
} }
resources { 'nagios_command': case $::osfamily {
'RedHat': {
augeas {'configs':
lens => 'NagiosCfg.lns',
incl => '/etc/nagios*/*.cfg',
context => "/files/etc/${nagios::params::masterdir}/nagios.cfg",
changes => [
'rm cfg_file[position() > 1]',
"set cfg_dir \"/etc/${masterdir}/${nagios::master::proj_name}\"",
'set check_external_commands 1',
],
require => Package[$nagios::params::nagios3pkg],
notify => Service[$nagios::params::masterservice],
}
}
'Debian': {
augeas {'configs':
lens => 'NagiosCfg.lns',
incl => '/etc/nagios*/*.cfg',
context => "/files/etc/${nagios::params::masterdir}/nagios.cfg",
changes => [
"set cfg_dir[2] \"/etc/${masterdir}/${nagios::master::proj_name}\"",
'set check_external_commands 1',
],
require => Package[$nagios::params::nagios3pkg],
notify => Service[$nagios::params::masterservice],
}
}
}
File {
owner => root,
group => root,
mode => '0644',
require => Package[$nagios::params::nagios3pkg],
}
file {
"/etc/${nagios::params::masterdir}/${proj_name}/templates.cfg":
content => template('nagios/openstack/templates.cfg.erb');
"/etc/${nagios::params::masterdir}/${proj_name}/hostgroup.cfg":
content => template('nagios/openstack/hostgroups.cfg.erb');
"/etc/${nagios::params::masterdir}/${nagios::params::htpasswd}":
content => template('nagios/common/etc/nagios3/htpasswd.users.erb');
}
file { "/etc/${nagios::params::masterdir}/${proj_name}":
recurse => true,
alias => 'conf.d',
notify => Service[$nagios::params::masterservice],
source => 'puppet:///modules/nagios/common/etc/nagios3/conf.d',
}
Resources {
purge => true, purge => true,
} }
resources { 'nagios_contact': resources {
purge => true, 'nagios_command':;
'nagios_contact':;
'nagios_contactgroup':;
'nagios_host':;
'nagios_hostgroup':;
'nagios_hostextinfo':;
'nagios_service':;
'nagios_servicegroup':;
} }
resources { 'nagios_contactgroup': service { $nagios::params::masterservice:
purge => true,
}
resources { 'nagios_host':
purge => true,
}
resources { 'nagios_hostgroup':
purge => true,
}
resources { 'nagios_hostextinfo':
purge => true,
}
resources { 'nagios_service':
purge => true,
}
resources { 'nagios_servicegroup':
purge => true,
}
service { 'nagios3':
ensure => running, ensure => running,
enable => true, enable => true,
hasrestart => true, hasrestart => true,
@ -141,7 +133,7 @@ $contacts = {'user' => 'hotkey', 'alias' => 'Dennis Hoppe',
require => [ require => [
Augeas['configs'], Augeas['configs'],
File['conf.d'], File['conf.d'],
Package['nagios3'] Package[$nagios::params::nagios3pkg]
], ],
} }
} }

View File

@ -8,8 +8,8 @@ $include_dir = '/etc/nagios/nrpe.d',
group => root, group => root,
mode => '0644', mode => '0644',
alias => 'nrpe.cfg', alias => 'nrpe.cfg',
notify => Service['nagios-nrpe-server'], notify => Service[$nagios::params::nrpeservice],
content => template('nagios/common/etc/nagios/nrpe.cfg.erb'), content => template('nagios/common/etc/nagios/nrpe.cfg.erb'),
require => Package['nagios-nrpe-server'], require => Package[$nagios::params::nrpepkg],
} }
} }

View File

@ -34,4 +34,43 @@ class nagios::params {
'swap' => 'nrpe_check_swap!20%!10%', 'swap' => 'nrpe_check_swap!20%!10%',
'user' => 'nrpe_check_users!5!10', 'user' => 'nrpe_check_users!5!10',
} }
case $::osfamily {
'RedHat': {
$nagios3pkg = [
'nagios',
'nagios-plugins-nrpe',
'nagios-plugins-all' ]
$nrpepkg = [
'binutils',
'openssl',
'nrpe',
'nagios-plugins-nrpe',
'perl-Nagios-Plugin',
'nagios-plugins-all' ]
$masterdir = 'nagios'
$htpasswd = 'passwd'
$libdir = '/usr/lib64'
$nrpeservice = 'nrpe'
$masterservice = 'nagios'
$distro = inline_template("<%= scope.lookupvar('::operatingsystem').downcase -%>")
}
'Debian': {
$nagios3pkg = [
'nagios3',
'nagios-nrpe-plugin' ]
$nrpepkg = [
'binutils',
'libnagios-plugin-perl',
'nagios-nrpe-server',
'nagios-plugins-basic',
'nagios-plugins-standard']
$masterdir = 'nagios3'
$htpasswd = 'htpasswd.users'
$libdir = '/usr/lib'
$nrpeservice = 'nagios-nrpe-server'
$masterservice = 'nagios3'
$distro = inline_template("<%= scope.lookupvar('::lsbdistid').downcase -%>")
}
}
} }

View File

@ -5,6 +5,6 @@ define nagios::service::servicegroups() {
nagios_servicegroup { $name: nagios_servicegroup { $name:
ensure => present, ensure => present,
# alias => $alias, # alias => $alias,
target => "/etc/nagios3/${proj_name}/servicegroups.cfg", target => "/etc/${nagios::params::masterdir}/${proj_name}/servicegroups.cfg",
} }
} }

View File

@ -9,6 +9,6 @@ $group = false,
check_command => $command, check_command => $command,
service_description => $name, service_description => $name,
host_name => $::fqdn, host_name => $::fqdn,
target => "/etc/nagios3/${proj_name}/${::hostname}_services.cfg", target => "/etc/${nagios::params::masterdir}/${proj_name}/${::hostname}_services.cfg",
} }
} }

View File

@ -0,0 +1,12 @@
#
# THIS FILE IS MANAGED BY PUPPET
#
command[check_disk]=<%= libdir %>/nagios/plugins/check_disk -w $ARG1$ -c $ARG2$ -p $ARG3$
command[check_load]=<%= libdir %>/nagios/plugins/check_load -w $ARG1$,$ARG2$,$ARG3$ -c $ARG4$,$ARG5$,$ARG6$
command[check_mailq]=<%= libdir %>/nagios/plugins/check_mailq -w $ARG1$ -c $ARG2$
command[check_procs]=<%= libdir %>/nagios/plugins/check_procs -w $ARG1$ -c $ARG2$
command[check_procs_zombie]=<%= libdir %>/nagios/plugins/check_procs -w $ARG1$ -c $ARG2$ -s Z
command[check_ide_smart]=sudo <%= libdir %>/nagios/plugins/check_ide_smart -d $ARG1$ -n
command[check_swap]=<%= libdir %>/nagios/plugins/check_swap -w $ARG1$ -c $ARG2$
command[check_users]=<%= libdir %>/nagios/plugins/check_users -w $ARG1$ -c $ARG2$

View File

@ -0,0 +1,20 @@
#
# THIS FILE IS MANAGED BY PUPPET
#
command[check_nova_compute]=<%= libdir %>/nagios/plugins/check_procs -c 1:10 -C nova-compute
command[check_nova_network]=<%= libdir %>/nagios/plugins/check_procs -c 1:10 -C nova-network
command[check_nova_scheduler]=<%= libdir %>/nagios/plugins/check_procs -c 1:10 -C nova-scheduler
command[check_nova_consoleauth]=<%= libdir %>/nagios/plugins/check_procs -c 1:10 -a nova-consoleauth
command[check_nova_cert]=<%= libdir %>/nagios/plugins/check_procs -c 1:10 -C nova-cert
command[check_cinder_scheduler]=<%= libdir %>/nagios/plugins/check_procs -c 1:10 -a cinder-scheduler
command[check_cinder_volume]=<%= libdir %>/nagios/plugins/check_procs -c 1:10 -C cinder-volume
command[check_haproxy]=<%= libdir %>/nagios/plugins/check_procs -c 1:10 -C haproxy
command[check_memcached]=<%= libdir %>/nagios/plugins/check_procs -c 1:10 -C memcached
command[check_glance_registry]=<%= libdir %>/nagios/plugins/check_procs -c 1:10 -C glance-registry
command[check_nova_novncproxy]=<%= libdir %>/nagios/plugins/check_procs -c 1:10 -a nova-novncproxy
command[check_swift_proxy]=<%= libdir %>/nagios/plugins/check_procs -c 1:10 -a swift-proxy-server
command[check_swift_account]=<%= libdir %>/nagios/plugins/check_procs -c 1:10 -a swift-account-server
command[check_swift_object]=<%= libdir %>/nagios/plugins/check_procs -c 1:10 -a swift-object-server
command[check_swift_container]=<%= libdir %>/nagios/plugins/check_procs -c 1:10 -a swift-container-server
command[check_swift_ring]=<%= libdir %>/nagios/plugins/check_os_swiftrecon objmd5
command[check_libvirt]=<%= libdir %>/nagios/plugins/check_os_libvirt connect -H 127.0.0.1 -m qemu+tcp

View File

@ -1,3 +1,6 @@
#
# THIS FILE IS MANAGED BY PUPPET
#
define host { define host {
use default-host use default-host
address cont-01-qa.qa.rr.lan address cont-01-qa.qa.rr.lan

View File

@ -1,3 +1,7 @@
#
# THIS FILE IS MANAGED BY PUPPET
#
<% if templatehost.kind_of? Hash %> <% if templatehost.kind_of? Hash %>
define host { define host {
<% templatehost.keys.each do |key| %> <% templatehost.keys.each do |key| %>