Skip to content

Instantly share code, notes, and snippets.

@fguillen
Created July 23, 2010 10:06
Show Gist options
  • Save fguillen/487242 to your computer and use it in GitHub Desktop.
Save fguillen/487242 to your computer and use it in GitHub Desktop.
God::Contacts::Email.defaults do |d|
d.from_email = '[email protected]'
d.delivery_method = :sendmail
end
God.contact(:email) do |c|
c.name = 'fguillen'
c.group = 'admins'
c.to_email = '[email protected]'
end
class God::Conditions::DiskUsage
def test
usage = `df -P | grep -i "^#{self.mount_point} " | awk '{print $5}' | sed 's/%//'`
if usage.to_i > self.above
self.info = "disk space out of bounds"
return true
else
self.info = "disk space ok"
return false
end
end
end
God.watch do |w|
w.name = 'disk_space'
w.interval = 30.minutes
w.start = ''
w.log = '/var/log/god.log'
w.lifecycle do |on|
on.condition(:disk_usage) do |c|
c.above = 85
c.mount_point = '/dev/sda1'
c.notify = 'admins'
end
end
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment