graphitewriter.pp 1.1 KB

1234567891011121314151617181920212223242526272829303132333435
  1. # == Defined type: icinga2::object::graphitewriter
  2. #
  3. # This is a defined type for Icinga 2 GraphiteWriter objects.
  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-graphitewriter
  6. #
  7. # === Parameters
  8. #
  9. # See the inline comments.
  10. #
  11. define icinga2::object::graphitewriter (
  12. $graphite_host = '127.0.0.1',
  13. $graphite_port = 2003,
  14. #Put the object files this defined type generates in features-available
  15. #since the Graphite writer feature is one that has to be explicitly enabled.
  16. $target_dir = '/etc/icinga2/features-available',
  17. $target_file_name = "${name}.conf",
  18. $target_file_owner = 'root',
  19. $target_file_group = 'root',
  20. $target_file_mode = '0644'
  21. ) {
  22. #Do some validation
  23. validate_string($host)
  24. file {"${target_dir}/${target_file_name}":
  25. ensure => file,
  26. owner => $target_file_owner,
  27. group => $target_file_group,
  28. mode => $target_file_mode,
  29. content => template('icinga2/object_graphitewriter.conf.erb'),
  30. notify => Service['icinga2'],
  31. }
  32. }