dev/provisioning/modules/puppi/manifests/check.pp
author ymh <ymh.work@gmail.com>
Fri, 15 Jan 2016 15:35:00 +0100
changeset 28 b0b56e0f8c7f
permissions -rwxr-xr-x
Add contributor edition - added viaf resolver - improve contributors list display - add update of document objects - propagate update to back office - update back office - add bo-client to back office - setup language initializer - add options mechanism - add language information in language list - add lexvo resolver service + api - add language and lexvo resolver to js app - correct env template - refresh bootstrap - download google font - add version information - update dev virtual machine to centos7 - add a readme + clean folders - add local .env file to start commands

# 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',
  }

}