diff --git a/manifests/init.pp b/manifests/init.pp index 8051cc3..a1a6f29 100644 --- a/manifests/init.pp +++ b/manifests/init.pp @@ -60,7 +60,23 @@ } } -define monit::pidcheck ($process_name, $pidfile, $start_prog, $stop_prog) { +define monit::pidcheck ($process_name = undef, $pidfile = undef, $start_prog = undef, $stop_prog = undef) { + $process_name_real = $process_name ? { + undef => $name, + default => $process_name, + } + $pidfile_real = $pidfile ? { + undef => "/var/run/${process_name_real}.pid", + default => $pidfile, + } + $start_prog_real = $start_prog ? { + undef => "/etc/init.d/${process_name_real} start", + default => $start_prog, + } + $stop_prog_real = $stop_prog ? { + undef => "/etc/init.d/${process_name_real} stop", + default => $stop_prog, + } file { "/etc/monit/conf.d/$name": mode => 600, owner => root, diff --git a/templates/pidcheck.erb b/templates/pidcheck.erb index 0cb5638..77f2681 100644 --- a/templates/pidcheck.erb +++ b/templates/pidcheck.erb @@ -1,6 +1,6 @@ # # automatically generated by puppet for <%= fqdn %>, DO NOT MODIFY! # -check process <%= process_name %> with pidfile <%= pidfile %> - start program = "<%= start_prog %>" - stop program = "<%= stop_prog %>" +check process <%= process_name_real %> with pidfile <%= pidfile_real %> + start program = "<%= start_prog_real %>" + stop program = "<%= stop_prog_real %>"