diff -r a2342f26c9de -r b0b56e0f8c7f dev/provisioning/modules/puppi/manifests/check.pp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/dev/provisioning/modules/puppi/manifests/check.pp Fri Jan 15 15:35:00 2016 +0100 @@ -0,0 +1,50 @@ +# Define puppi::check +# +# This define creates a file with a check command that can be used locally. +# It uses Nagios plugins for all checks so that $command is just the +# plugin name with its arguments +# +# == Usage +# Basic Usage: +# puppi::check { "checkname": +# command => "check_tcp -H localhost -p 80" +# } +# +# :include:../README.check +# +define puppi::check ( + $command, + $base_dir = '', + $hostwide = 'no', + $priority = '50', + $project = 'default', + $enable = true ) { + + require puppi + require puppi::params + + $ensure = bool2ensure($enable) + $bool_hostwide = any2bool($hostwide) + + $real_base_dir = $base_dir ? { + '' => $puppi::params::checkpluginsdir, + default => $base_dir, + } + + $path = $bool_hostwide ? { + true => "${puppi::params::checksdir}/${priority}-${name}" , + false => "${puppi::params::projectsdir}/${project}/check/${priority}-${name}", + } + + file { "Puppi_check_${project}_${priority}_${name}": + ensure => $ensure, + path => $path, + mode => '0755', + owner => $puppi::params::configfile_owner, + group => $puppi::params::configfile_group, + require => Class['puppi'], + content => "${real_base_dir}/${command}\n", + tag => 'puppi_check', + } + +}