icingastatuswriter.pp 1.4 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344
  1. # == Defined type: icinga2::object::icingastatuswriter
  2. #
  3. # This is a defined type for Icinga 2 apply objects that create IcingaStatusWriter
  4. # See the following Icinga 2 doc page for more info:
  5. # http://docs.icinga.org/icinga2/latest/doc/module/icinga2/chapter/configuring-icinga2#objecttype-checkercomponent
  6. #
  7. # === Parameters
  8. #
  9. # See the inline comments.
  10. #
  11. define icinga2::object::icingastatuswriter (
  12. $ensure = 'file',
  13. $object_name = $name,
  14. $status_path = undef,
  15. $update_interval = undef,
  16. $target_dir = '/etc/icinga2/objects/icingastatuswriters',
  17. $target_file_name = "${name}.conf",
  18. $target_file_owner = 'root',
  19. $target_file_group = 'root',
  20. $target_file_mode = '0644'
  21. ) {
  22. if $status_path {
  23. validate_string($status_path)
  24. }
  25. if $update_interval {
  26. validate_string($update_interval)
  27. }
  28. validate_string($target_dir)
  29. validate_string($target_file_name)
  30. validate_string($target_file_owner)
  31. validate_string($target_file_group)
  32. validate_re($target_file_mode, '^\d{4}$')
  33. file {"${target_dir}/${target_file_name}":
  34. ensure => $ensure,
  35. owner => $target_file_owner,
  36. group => $target_file_group,
  37. mode => $target_file_mode,
  38. content => template('icinga2/object_icingastatuswriter.conf.erb'),
  39. notify => Service['icinga2'],
  40. }
  41. }