diff --git a/manifests/monit.pp b/manifests/monit.pp index 52afa2a..87a4727 100644 --- a/manifests/monit.pp +++ b/manifests/monit.pp @@ -69,3 +69,14 @@ require => File['/etc/monit/conf.d'], } } + +define monit::clamdcheck ($clamd_port=3310, $clamd_ips=[]) { + file { "/etc/monit/conf.d/$name": + mode => 600, + owner => root, + group => root, + content => template("/etc/puppet/modules/monit/templates/clamd.erb"), + notify => Service['monit'], + require => File['/etc/monit/conf.d'], + } +} diff --git a/templates/clamd.erb b/templates/clamd.erb new file mode 100644 index 0000000..1bc843f --- /dev/null +++ b/templates/clamd.erb @@ -0,0 +1,10 @@ +# +# automatically generated by puppet for <%= fqdn %>, DO NOT MODIFY! +# +check process clamd with pidfile /var/run/clamav/clamd.pid + start program = "/etc/inid.d/clamav-daemon start" + stop program = "/etc/inid.d/clamav-daemon stop" + if failed host 127.0.0.1 port <%= clamd_port %> protocol CLAMAV for 5 cycle then restart + <% clamd_ips.each do |clamd_ip| -%> + if failed host <%= clamd_ip %> port <%= clamd_port %> protocol CLAMAV for 5 cycle then restart + <%- end %>