I've solved the identical problem using defines instead of classes. I
know that hiera can be a better solution, but I'm waiting for next
major release to adopt hiera.
I've a generic nrpe::check define: each check is a define that use
this generic definition, so my check_load.pp in nrpe module is
define nrpe::check_load(
$warn1=8,
$warn5=4,
$warn15=2,
$crit1=20,
$crit5=10,
$crit15=5,
)
{
if ! is_numeric($warn1)
{
fail('Variable warn1 must be numeric')
}
if ! is_numeric($warn5)
{
fail('Variable warn5 must be numeric')
}
if ! is_numeric($warn15)
{
fail('Variable warn15 must be numeric')
}
if ! is_numeric($crit1)
{
fail('Variable crit1 must be numeric')
}
if ! is_numeric($crit5)
{
fail('Variable crit5 must be numeric')
}
if ! is_numeric($crit15)
{
fail('Variable crit15 must be numeric')
}
# -r plugin option make it compatible with multi-core cpu
nrpe::check{ 'load':
params => "-r -w ${warn1},${warn5},${warn15} -c
${crit1},${crit5},${crit15}"
}
}
In generic_host I create a resource with no parameters, so defaults apply:
nrpe::check_load { 'load': }
If I've a node with a medium greater load than my default I do:
node 'node-with-high-load' inherits generic_host {
Nrpe::Check_load['load']{ warn5 => 20 }
}
Hopes this helps,
L
2012/9/25 George Shammas <
geo...@gmail.com>: