plugin.pp 1.3 KB

12345678910111213141516171819202122232425262728293031323334353637
  1. # Define icinga2::nrpe::plugin
  2. #
  3. # This defined type distributes .
  4. #
  5. # Parameters:
  6. # * $plugin_name = What Puppet knows this plugin resource as. This is used to create the
  7. # filenameon the client machine in the file resource. By default, it's
  8. # taken from the resource's name
  9. #
  10. # * $nrpe_plugin_libdir = The directory where the NRPE plugins themselves live
  11. #
  12. # * $source_file = The file that will get distributed to Icinga client machines. This can
  13. # be anywhere on your Puppet master. See http://docs.puppetlabs.com/references/3.stable/type.html#file-attribute-source
  14. # for more info on what formats of URLs you can use to specify which files
  15. # you want to distribute.
  16. define icinga2::nrpe::plugin (
  17. $plugin_name = $name,
  18. $nrpe_plugin_libdir = $icinga2::params::nrpe_plugin_libdir,
  19. $source_file = undef,
  20. ) {
  21. #Do some validation of the class' parameters:
  22. validate_string($name)
  23. validate_string($nrpe_plugin_libdir)
  24. file { "${nrpe_plugin_libdir}/${plugin_name}":
  25. owner => 'root',
  26. group => 'root',
  27. mode => '755',
  28. source => $source_file,
  29. require => Package[$icinga2::params::icinga2_client_packages],
  30. notify => Service[$icinga2::params::nrpe_daemon_name]
  31. }
  32. }