Puppet Plan: patching::monitoring_solarwinds
- Defined in:
- plans/monitoring_solarwinds.pp
Summary
Enable or disable monitoring alerts on hosts in SolarWinds.Overview
TODO config variables
65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 |
# File 'plans/monitoring_solarwinds.pp', line 65
plan patching::monitoring_solarwinds (
TargetSpec $targets,
Enum['enable', 'disable'] $action,
Optional[Enum['name', 'uri']] $target_name_property = undef,
Optional[TargetSpec] $monitoring_target = undef,
Optional[String[1]] $monitoring_name_property = undef,
Boolean $noop = false,
) {
$_targets = run_plan('patching::get_targets', $targets)
$group_vars = $_targets[0].vars
$_target_name_property = pick($target_name_property,
$group_vars['patching_monitoring_target_name_property'],
'uri')
$_monitoring_name_property = pick($monitoring_name_property,
$group_vars['patching_monitoring_name_property'],
'DNS')
$_monitoring_target = pick($monitoring_target,
$group_vars['patching_monitoring_target'],
'solarwinds')
# Create array of node names
$target_names = patching::target_names($_targets, $_target_name_property)
# Display status message
case $action {
'enable': {
out::message('Enabling monitoring for:')
$target_names.each |$n| {
out::message(" + ${n}")
}
}
'disable': {
out::message('Disabling monitoring for:')
$target_names.each |$n| {
out::message(" - ${n}")
}
}
default: {
fail_plan("Unknown action: ${action}")
}
}
if !$noop {
return run_task('patching::monitoring_solarwinds', $_monitoring_target,
targets => $target_names,
action => $action,
name_property => $_monitoring_name_property)
}
}
|