Skip to content

Instantly share code, notes, and snippets.

@bbg-deploy
Created January 14, 2014 20:30
Show Gist options
  • Save bbg-deploy/8425118 to your computer and use it in GitHub Desktop.
Save bbg-deploy/8425118 to your computer and use it in GitHub Desktop.
rsyslog_pid = value_for_platform_family(
'rhel' => '/var/run/syslogd.pid',
'debian' => '/var/run/rsyslogd.pid',
)
monit_check 'rsyslog' do
check_id rsyslog_pid
group 'system'
start '/etc/init.d/rsyslog start'
stop '/etc/init.d/rsyslog stop'
tests [
{
'condition' => '4 restarts within 5 cycles',
'action' => 'timeout',
}
]
end
monit_check 'postfix' do
check_id '/var/spool/postfix/pid/master.pid'
group 'system'
start '/etc/init.d/postfix start'
stop '/etc/init.d/postfix stop'
service_tests [
{
'condition' => 'failed port 25 proto smtp 2 times within 3 cycles',
'action' => 'restart',
},
{
'condition' => '3 restarts within 5 cycles',
'action' => 'alert',
},
]
end
sshd_init = value_for_platform_family(
'rhel' => '/etc/init.d/sshd',
'debian' => '/etc/init.d/ssh'
)
monit_check 'sshd' do
check_id '/var/run/sshd.pid'
group 'system'
start "#{sshd_init} start"
stop "#{sshd_init} stop"
tests [
{
'condition' => 'failed port 22 proto ssh 2 times within 3 cycles',
'action' => 'restart',
},
{
'condition' => '3 restarts within 5 cycles',
'action' => 'alert',
},
]
end
crond_init = value_for_platform_family(
'rhel' => '/etc/init.d/crond',
'debian' => '/etc/init.d/cron',
)
monit_check 'crond' do
check_id '/var/run/crond.pid'
group 'system'
start "#{crond_init} start"
stop "#{crond_init} stop"
tests [
{
'condition' => '3 restarts within 5 cycles',
'action' => 'alert',
},
]
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment