Module God
In: lib/god.rb
lib/god/behavior.rb
lib/god/behaviors/clean_pid_file.rb
lib/god/behaviors/clean_unix_socket.rb
lib/god/behaviors/notify_when_flapping.rb
lib/god/cli/command.rb
lib/god/cli/run.rb
lib/god/cli/version.rb
lib/god/condition.rb
lib/god/conditions/always.rb
lib/god/conditions/complex.rb
lib/god/conditions/cpu_usage.rb
lib/god/conditions/degrading_lambda.rb
lib/god/conditions/disk_usage.rb
lib/god/conditions/file_mtime.rb
lib/god/conditions/flapping.rb
lib/god/conditions/http_response_code.rb
lib/god/conditions/lambda.rb
lib/god/conditions/memory_usage.rb
lib/god/conditions/process_exits.rb
lib/god/conditions/process_running.rb
lib/god/conditions/tries.rb
lib/god/configurable.rb
lib/god/contact.rb
lib/god/contacts/campfire.rb
lib/god/contacts/email.rb
lib/god/contacts/jabber.rb
lib/god/contacts/twitter.rb
lib/god/contacts/webhook.rb
lib/god/dependency_graph.rb
lib/god/driver.rb
lib/god/errors.rb
lib/god/event_handler.rb
lib/god/event_handlers/dummy_handler.rb
lib/god/event_handlers/kqueue_handler.rb
lib/god/event_handlers/netlink_handler.rb
lib/god/logger.rb
lib/god/metric.rb
lib/god/process.rb
lib/god/registry.rb
lib/god/simple_logger.rb
lib/god/socket.rb
lib/god/system/portable_poller.rb
lib/god/system/process.rb
lib/god/system/slash_proc_poller.rb
lib/god/task.rb
lib/god/timeline.rb
lib/god/trigger.rb
lib/god/watch.rb

Methods

Classes and Modules

Module God::Behaviors
Module God::CLI
Module God::Conditions
Module God::Configurable
Module God::Contacts
Module God::System
Class God::AbstractMethodNotOverriddenError
Class God::Behavior
Class God::Condition
Class God::Contact
Class God::DependencyGraph
Class God::Driver
Class God::DriverEvent
Class God::DriverEventQueue
Class God::DriverOperation
Class God::DummyHandler
Class God::EventCondition
Class God::EventHandler
Class God::EventRegistrationFailedError
Class God::InvalidCommandError
Class God::KQueueHandler
Class God::Logger
Class God::Metric
Class God::NetlinkHandler
Class God::NoSuchBehaviorError
Class God::NoSuchConditionError
Class God::NoSuchContactError
Class God::NoSuchWatchError
Class God::PollCondition
Class God::Process
Class God::Registry
Class God::SimpleLogger
Class God::Socket
Class God::Task
Class God::TimedEvent
Class God::Timeline
Class God::Trigger
Class God::TriggerCondition
Class God::Watch

Constants

VERSION = '0.7.12'
LOG_BUFFER_SIZE_DEFAULT = 100
PID_FILE_DIRECTORY_DEFAULTS = ['/var/run/god', '~/.god/pids']
DRB_PORT_DEFAULT = 17165
DRB_ALLOW_DEFAULT = ['127.0.0.1']
LOG_LEVEL_DEFAULT = :info

Attributes

contact_groups  [RW]  internal
contacts  [RW]  internal
groups  [RW]  internal
inited  [RW]  internal
main  [RW]  internal
pending_watch_states  [RW]  internal
pending_watches  [RW]  internal
running  [RW]  internal
server  [RW]  internal
watches  [RW]  internal

Public Class methods

To be called on program exit to start god

Returns nothing

Instantiate a new Contact of the given kind and send it to the block. Then prepare, validate, and record the Contact.

  +kind+ is the contact class specifier

Aborts on invalid kind

          duplicate contact name
          invalid contact
          conflicting group name

Returns nothing

Control the lifecycle of the given task(s).

  +name+ is the name of a task/group (String)
  +command+ is the command to run (String)
            one of: "start"
                    "monitor"
                    "restart"
                    "stop"
                    "unmonitor"
                    "remove"

Returns String[]:task_names

Initialize internal data.

Returns nothing

Load the given file(s) according to the given glob.

  +glob+ is the glob-enabled path to load

Returns nothing

Match a shortened pattern against a list of String candidates. The pattern is expanded into a regular expression by inserting .* between each character.

  +pattern+ is the String containing the abbreviation
  +list+ is the Array of Strings to match against

Examples

  list = %w{ foo bar bars }
  pattern = 'br'
  God.pattern_match(list, pattern)
  # => ['bar', 'bars']

Returns String[]:matched_elements

Load a config file into a running god instance. Rescues any exceptions that the config may raise and reports these back to the caller.

  +code+ is a String containing the config file
  +filename+ is the filename of the config file

Returns [String[]:task_names, String:errors]

Log lines for the given task since the specified time.

  +watch_name+ is the name of the task (may be abbreviated)
  +since+ is the Time since which to report log lines

Raises God::NoSuchWatchError if no tasks matched

Returns String:joined_log_lines

Send a signal to each task.

  +name+ is the String name of the task or group
  +signal+ is the signal to send. e.g. HUP, 9

Returns String[]:task_names

Initialize and startup the machinery that makes god work.

Returns nothing

Gather the status of each task.

Examples

  God.status
  # => { 'mongrel' => :up, 'nginx' => :up }

Returns { String:task_name => Symbol:status, … }

Unmonitor and stop all tasks.

Returns true on success

        false if all tasks could not be stopped within 10 seconds

Instantiate a new, empty Task object and yield it to the mandatory block. The attributes of the task will be set by the configuration file.

Aborts on duplicate task name

          invalid task
          conflicting group name

Returns nothing

Force the termination of god.

  * Clean up pid file if one exists
  * Stop DRb service
  * Hard exit using exit!

Never returns because the process will no longer exist!

Remove the given contact from god.

  +contact+ is the Contact to remove

Returns nothing

Unmonitor and remove the given watch from god.

  +watch+ is the Watch to remove

Returns nothing

Instantiate a new, empty Watch object and pass it to the mandatory block. The attributes of the watch will be set by the configuration file.

Aborts on duplicate watch name

          invalid watch
          conflicting group name

Returns nothing

[Validate]