Ok, I'm going to try and unravel this.
In the condition.rb, the PollCondition class has this code
# Override this method in your Conditions (mandatory)
#
# Return true if the test passes (everything is ok)
# Return false otherwise
def test
raise AbstractMethodNotOverriddenError.new("PollCondition#test
must be overridden in subclasses")
end
So I checked the disk_usage.rb file, and the test looks like this
def test
usage = `df | grep -i " #{self.mount_point}$" | awk '{print
$5}' | sed 's/%//'`
usage.to_i > self.above
end
so, we're overwriting our test condition in our pollcondition, which
is mandatory
from the logic above it says it will return true if the test passes,
which means everything is ok. So if your usage.to_i is higher than
the above setting, then it will return True. Am I being dull or is
that not the wrong way around?
I'm changing the direction of the arrow to see if it makes any
difference.
On Jan 27, 5:08 pm, vanderkerkoff <[email protected]> wrote:
> Hello everyone
>
> Has anyone managed to get god to send them an email when a certain
> amount of space has been used on the system using disk_usage?
>
> I'm pulling my hair out here :-).
>
> #Watching the disk space
> God.watch do |w|
> w.name = 'disk_space'
> w.interval = 2.minutes
> w.start = ''
>
> w.lifecycle do |on|
> on.condition(:disk_usage) do |c|
> c.above = 30
> c.mount_point = '/dev/sda1'
> c.notify = "matt"
> end
> end
> end
>
> god log says it's ok, but I'm using 34 percent of that mount point, I
> ran the line from the actual ruby file to check
>
> df | grep -i "/dev/sda1" | awk '{print $5}' | sed 's/%//'
>
> that comes back with 34
>
> any help would be greatly appreciated
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups
"god.rb" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to
[email protected]
For more options, visit this group at
http://groups.google.com/group/god-rb?hl=en
-~----------~----~----~----~------~----~------~--~---