Skip to content

Commit

Permalink
fix #580 Add missed flapping attributes to objects host and service
Browse files Browse the repository at this point in the history
  • Loading branch information
lbetz committed Jul 26, 2019
1 parent 27c1b9e commit 38b7725
Show file tree
Hide file tree
Showing 3 changed files with 145 additions and 130 deletions.
14 changes: 10 additions & 4 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -1875,8 +1875,11 @@ Whether performance data processing is enabled. Defaults to `true`
##### `event_command`
The name of an event command that should be executed every time the host's state changes or the host is in a SOFT state.

##### `flapping_threshold`
The flapping threshold in percent when a host is considered to be flapping.
##### `flapping_threshold_low`
Flapping lower bound in percent for a host to be considered not flapping. Icinga defaults to 25.0.

##### `flapping_threshold_low`
Flapping upper bound in percent for a host to be considered flapping. Icinga defaults to 30.0.

##### `volatile`
The volatile setting enables always HARD state types if NOT-OK state changes occur.
Expand Down Expand Up @@ -2285,8 +2288,11 @@ Whether performance data processing is enabled. Defaults to `true`
The name of an event command that should be executed every time the service's state changes or the service is in a SOFT
state.

##### `flapping_threshold`
The flapping threshold in percent when a service is considered to be flapping.
##### `flapping_threshold_low`
Flapping lower bound in percent for a host to be considered not flapping. Icinga defaults to 25.0.

##### `flapping_threshold_low`
Flapping upper bound in percent for a host to be considered flapping. Icinga defaults to 30.0.

##### `volatile`
The volatile setting enables always HARD state types if NOT-OK state changes occur.
Expand Down
129 changes: 67 additions & 62 deletions manifests/object/host.pp
Original file line number Diff line number Diff line change
Expand Up @@ -70,11 +70,14 @@
# The name of an event command that should be executed every time the host's
# state changes or the host is in a SOFT state.
#
# [*flapping_threshold*]
# The flapping threshold in percent when a host is considered to be flapping.
# [*flapping_threshold_low*]
# Flapping lower bound in percent for a host to be considered not flapping. Icinga defaults to 25.0.
#
# [*flapping_threshold_high*]
# Flapping upper bound in percent for a host to be considered flapping. Icinga defaults to 30.0.
#
# [*volatile*]
# The volatile setting enables always HARD state types if NOT-OK state changes occur.
# The volatile setting enables always HARD state types if NOT-OK state changes occur.
#
# [*zone*]
# The zone this object is a member of.
Expand Down Expand Up @@ -110,69 +113,71 @@
#
define icinga2::object::host(
Stdlib::Absolutepath $target,
Enum['absent', 'present'] $ensure = present,
String $host_name = $title,
Array $import = [],
Optional[Stdlib::Host] $address = undef,
Optional[Stdlib::Host] $address6 = undef,
Optional[Icinga2::CustomAttributes] $vars = undef,
Optional[Array] $groups = undef,
Optional[String] $display_name = undef,
Optional[String] $check_command = undef,
Optional[Integer[1]] $max_check_attempts = undef,
Optional[String] $check_period = undef,
Optional[Icinga2::Interval] $check_timeout = undef,
Optional[Icinga2::Interval] $check_interval = undef,
Optional[Icinga2::Interval] $retry_interval = undef,
Optional[Boolean] $enable_notifications = undef,
Optional[Boolean] $enable_active_checks = undef,
Optional[Boolean] $enable_passive_checks = undef,
Optional[Boolean] $enable_event_handler = undef,
Optional[Boolean] $enable_flapping = undef,
Optional[Boolean] $enable_perfdata = undef,
Optional[String] $event_command = undef,
Optional[Integer[1]] $flapping_threshold = undef,
Optional[Boolean] $volatile = undef,
Optional[String] $zone = undef,
Optional[String] $command_endpoint = undef,
Optional[String] $notes = undef,
Optional[String] $notes_url = undef,
Optional[String] $action_url = undef,
Optional[Stdlib::Absolutepath] $icon_image = undef,
Optional[String] $icon_image_alt = undef,
Boolean $template = false,
Variant[String, Integer] $order = 50,
Enum['absent', 'present'] $ensure = present,
String $host_name = $title,
Array $import = [],
Optional[Stdlib::Host] $address = undef,
Optional[Stdlib::Host] $address6 = undef,
Optional[Icinga2::CustomAttributes] $vars = undef,
Optional[Array] $groups = undef,
Optional[String] $display_name = undef,
Optional[String] $check_command = undef,
Optional[Integer[1]] $max_check_attempts = undef,
Optional[String] $check_period = undef,
Optional[Icinga2::Interval] $check_timeout = undef,
Optional[Icinga2::Interval] $check_interval = undef,
Optional[Icinga2::Interval] $retry_interval = undef,
Optional[Boolean] $enable_notifications = undef,
Optional[Boolean] $enable_active_checks = undef,
Optional[Boolean] $enable_passive_checks = undef,
Optional[Boolean] $enable_event_handler = undef,
Optional[Boolean] $enable_flapping = undef,
Optional[Boolean] $enable_perfdata = undef,
Optional[String] $event_command = undef,
Optional[Integer[1]] $flapping_threshold_low = undef,
Optional[Integer[1]] $flapping_threshold_high = undef,
Optional[Boolean] $volatile = undef,
Optional[String] $zone = undef,
Optional[String] $command_endpoint = undef,
Optional[String] $notes = undef,
Optional[String] $notes_url = undef,
Optional[String] $action_url = undef,
Optional[Stdlib::Absolutepath] $icon_image = undef,
Optional[String] $icon_image_alt = undef,
Boolean $template = false,
Variant[String, Integer] $order = 50,
) {

# compose the attributes
$attrs = {
address => $address,
address6 => $address6,
groups => $groups,
display_name => $display_name,
check_command => $check_command,
max_check_attempts => $max_check_attempts,
check_period => $check_period,
check_timeout => $check_timeout,
check_interval => $check_interval,
retry_interval => $retry_interval,
enable_notifications => $enable_notifications,
enable_active_checks => $enable_active_checks,
enable_passive_checks => $enable_passive_checks,
enable_event_handler => $enable_event_handler,
enable_flapping => $enable_flapping,
enable_perfdata => $enable_perfdata,
event_command => $event_command,
flapping_threshold => $flapping_threshold,
volatile => $volatile,
zone => $zone,
command_endpoint => $command_endpoint,
notes => $notes,
notes_url => $notes_url,
action_url => $action_url,
icon_image => $icon_image,
icon_image_alt => $icon_image_alt,
vars => $vars,
address => $address,
address6 => $address6,
groups => $groups,
display_name => $display_name,
check_command => $check_command,
max_check_attempts => $max_check_attempts,
check_period => $check_period,
check_timeout => $check_timeout,
check_interval => $check_interval,
retry_interval => $retry_interval,
enable_notifications => $enable_notifications,
enable_active_checks => $enable_active_checks,
enable_passive_checks => $enable_passive_checks,
enable_event_handler => $enable_event_handler,
enable_flapping => $enable_flapping,
enable_perfdata => $enable_perfdata,
event_command => $event_command,
flapping_threshold_low => $flapping_threshold_low,
flapping_threshold_high => $flapping_threshold_high,
volatile => $volatile,
zone => $zone,
command_endpoint => $command_endpoint,
notes => $notes,
notes_url => $notes_url,
action_url => $action_url,
icon_image => $icon_image,
icon_image_alt => $icon_image_alt,
vars => $vars,
}

# create object
Expand Down
132 changes: 68 additions & 64 deletions manifests/object/service.pp
Original file line number Diff line number Diff line change
Expand Up @@ -74,9 +74,11 @@
# The name of an event command that should be executed every time the
# service's state changes or the service is in a SOFT state.
#
# [*flapping_threshold*]
# The flapping threshold in percent when a service is considered to be
# flapping.
# [*flapping_threshold_low*]
# Flapping lower bound in percent for a host to be considered not flapping. Icinga defaults to 25.0.
#
# [*flapping_threshold_high*]
# Flapping upper bound in percent for a host to be considered flapping. Icinga defaults to 30.0.
#
# [*volatile*]
# The volatile setting enables always HARD state types if NOT-OK state changes
Expand Down Expand Up @@ -160,71 +162,73 @@

define icinga2::object::service (
Stdlib::Absolutepath $target,
Enum['absent', 'present'] $ensure = present,
String $service_name = $title,
Optional[String] $display_name = undef,
Optional[String] $host_name = undef,
Optional[Array] $groups = undef,
Optional[Icinga2::CustomAttributes] $vars = undef,
Optional[String] $check_command = undef,
Optional[Integer[1]] $max_check_attempts = undef,
Optional[String] $check_period = undef,
Optional[Icinga2::Interval] $check_timeout = undef,
Optional[Icinga2::Interval] $check_interval = undef,
Optional[Icinga2::Interval] $retry_interval = undef,
Optional[Boolean] $enable_notifications = undef,
Optional[Boolean] $enable_active_checks = undef,
Optional[Boolean] $enable_passive_checks = undef,
Optional[Boolean] $enable_event_handler = undef,
Optional[Boolean] $enable_flapping = undef,
Optional[Boolean] $enable_perfdata = undef,
Optional[String] $event_command = undef,
Optional[Integer[1]] $flapping_threshold = undef,
Optional[Boolean] $volatile = undef,
Optional[String] $zone = undef,
Optional[String] $command_endpoint = undef,
Optional[String] $notes = undef,
Optional[String] $notes_url = undef,
Optional[String] $action_url = undef,
Optional[Stdlib::Absolutepath] $icon_image = undef,
Optional[String] $icon_image_alt = undef,
Variant[Boolean, String] $apply = false,
Variant[Boolean, String] $prefix = false,
Array $assign = [],
Array $ignore = [],
Array $import = [],
Boolean $template = false,
Variant[String, Integer] $order = 60,
Enum['absent', 'present'] $ensure = present,
String $service_name = $title,
Optional[String] $display_name = undef,
Optional[String] $host_name = undef,
Optional[Array] $groups = undef,
Optional[Icinga2::CustomAttributes] $vars = undef,
Optional[String] $check_command = undef,
Optional[Integer[1]] $max_check_attempts = undef,
Optional[String] $check_period = undef,
Optional[Icinga2::Interval] $check_timeout = undef,
Optional[Icinga2::Interval] $check_interval = undef,
Optional[Icinga2::Interval] $retry_interval = undef,
Optional[Boolean] $enable_notifications = undef,
Optional[Boolean] $enable_active_checks = undef,
Optional[Boolean] $enable_passive_checks = undef,
Optional[Boolean] $enable_event_handler = undef,
Optional[Boolean] $enable_flapping = undef,
Optional[Boolean] $enable_perfdata = undef,
Optional[String] $event_command = undef,
Optional[Integer[1]] $flapping_threshold_low = undef,
Optional[Integer[1]] $flapping_threshold_high = undef,
Optional[Boolean] $volatile = undef,
Optional[String] $zone = undef,
Optional[String] $command_endpoint = undef,
Optional[String] $notes = undef,
Optional[String] $notes_url = undef,
Optional[String] $action_url = undef,
Optional[Stdlib::Absolutepath] $icon_image = undef,
Optional[String] $icon_image_alt = undef,
Variant[Boolean, String] $apply = false,
Variant[Boolean, String] $prefix = false,
Array $assign = [],
Array $ignore = [],
Array $import = [],
Boolean $template = false,
Variant[String, Integer] $order = 60,
) {

# compose the attributes
$attrs = {
'display_name' => $display_name ,
'host_name' => $host_name ,
'check_command' => $check_command ,
'check_timeout' => $check_timeout ,
'check_interval' => $check_interval ,
'check_period' => $check_period ,
'retry_interval' => $retry_interval ,
'max_check_attempts' => $max_check_attempts ,
'groups' => $groups ,
'enable_notifications' => $enable_notifications ,
'enable_active_checks' => $enable_active_checks ,
'enable_passive_checks' => $enable_passive_checks ,
'enable_event_handler' => $enable_event_handler ,
'enable_flapping' => $enable_flapping ,
'enable_perfdata' => $enable_perfdata ,
'event_command' => $event_command ,
'flapping_threshold' => $flapping_threshold ,
'volatile' => $volatile ,
'zone' => $zone ,
'command_endpoint' => $command_endpoint ,
'notes' => $notes ,
'notes_url' => $notes_url ,
'action_url' => $action_url ,
'icon_image' => $icon_image ,
'icon_image_alt' => $icon_image_alt ,
'vars' => $vars ,
'display_name' => $display_name,
'host_name' => $host_name,
'check_command' => $check_command,
'check_timeout' => $check_timeout,
'check_interval' => $check_interval,
'check_period' => $check_period,
'retry_interval' => $retry_interval,
'max_check_attempts' => $max_check_attempts,
'groups' => $groups,
'enable_notifications' => $enable_notifications,
'enable_active_checks' => $enable_active_checks,
'enable_passive_checks' => $enable_passive_checks,
'enable_event_handler' => $enable_event_handler,
'enable_flapping' => $enable_flapping,
'enable_perfdata' => $enable_perfdata,
'event_command' => $event_command,
'flapping_threshold_low' => $flapping_threshold_low,
'flapping_threshold_high' => $flapping_threshold_high,
'volatile' => $volatile,
'zone' => $zone,
'command_endpoint' => $command_endpoint,
'notes' => $notes,
'notes_url' => $notes_url,
'action_url' => $action_url,
'icon_image' => $icon_image,
'icon_image_alt' => $icon_image_alt,
'vars' => $vars,
}

# create object
Expand Down

0 comments on commit 38b7725

Please sign in to comment.