Hi vanderkerkoff,

I actually wrote the original (current, hasn't changed?) disk_usage
condition... at the time of writing it worked properly for me however
there was (is?) a bug in the way notifications are (not) sent out from
inside lifecycle conditions... I'll take a look when I have a moment
but other people have had similar issues and it always seems to stem
from trying to send notifications in lifecycle conditions.

Sorry you're having issues - I'll do my best to take a look at this
some point tonight (might be tomorrow morning/afternoon before you
hear back from if) if I can, but I can't make any promises (I'm at a
training event right now and won't be home for another four days
still...).

Thanks,
-Rudy X. Desjardins

On Wed, Jan 28, 2009 at 6:09 AM, vanderkerkoff <[email protected]> wrote:
>
> ok, I officially give up.
>
> If I change the direction of the arrow, I get emails even though the
> status is saying ok, and it's completely independent of what number I
> put in as the above level.
>
> If I change the direction of the arrow back to it's original state, I
> don't get emails regardless of what value I put in as the above value
> and it continues to say it's ok.
>
> Please please please will someone put up a working piece of code on
> how god monitors disk space with disk_usage.rb.
>
> As far as I can tell, it does not work in it's current format
>
> I'm running god-0.7.12
>
> If anyone knows where I can log a bug for it then please let me know
>
>
>
> On Jan 28, 1:33 pm, vanderkerkoff <[email protected]> wrote:
>> 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
> >
>



-- 
- Rudy X. Desjardins
http://rudy.theendless.org/gpg.pub.key.txt

--~--~---------~--~----~------------~-------~--~----~
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
-~----------~----~----~----~------~----~------~--~---

Reply via email to