nagios.pp 552 B

123456789101112131415161718192021222324
  1. define sshd::nagios(
  2. $port = 'absent',
  3. $ensure = 'present',
  4. $check_hostname = 'absent'
  5. ) {
  6. $real_port = $port ? {
  7. 'absent' => $name,
  8. default => $port,
  9. }
  10. case $check_hostname {
  11. 'absent': {
  12. nagios::service{"ssh_port_${name}":
  13. ensure => $ensure,
  14. check_command => "check_ssh_port!${real_port}"
  15. }
  16. }
  17. default: {
  18. nagios::service{"ssh_port_host_${name}":
  19. ensure => $ensure,
  20. check_command => "check_ssh_port_host!${real_port}!${check_hostname}"
  21. }
  22. }
  23. }
  24. }