Class: God::Conditions::CpuUsage

Class | God::Conditions::CpuUsage
In: | lib/god/conditions/cpu_usage.rb
Parent: | PollCondition

Condition Symbol :cpu_usage Type: Poll

Trigger when the percent of CPU use of a process is above a specified limit. On multi-core systems, this number could conceivably be above 100.

Paramaters

      Required
        +pid_file+ is the pid file of the process in question. Automatically
                   populated for Watches.
        +above+ is the percent CPU above which to trigger the condition. You
                may use #percent to clarify this amount (see examples).

Examples

Trigger if the process is using more than 25 percent of the cpu (from a Watch):

      on.condition(:cpu_usage) do |c|
        c.above = 25.percent
      end

Non-Watch Tasks must specify a PID file:

      on.condition(:cpu_usage) do |c|
        c.above = 25.percent
        c.pid_file = "/var/run/mongrel.3000.pid"
      end

### Methods

new pid prepare reset test valid?

### Attributes

above | [RW] |
pid_file | [RW] |
times | [RW] |

### Public Class methods

new()

### Public Instance methods

pid()
prepare()
reset()
test()
valid?()

[Validate]