Sha256: 0038f867bb885ddc79091533652c988c53572278d3350f8e7cef2e49a972145e

Contents?: true

Size: 811 Bytes

Versions: 1

Compression:

Stored size: 811 Bytes

Contents

# This is an example of a signal which will be polled for status by the
# SignalRunner. As you can see, all you need to do is implement the #run 
# method. Of course, nothing is stopping you doing anything else: the class 
# can be as complicated as you want and do anything you want it to, as long as
# it returns a Hash of data using #run.
#
# To deal with data on the server side, create a class that extends 
# Smoke::SignalProcesor.
#
module Smoke
  class SystemLoad < Smoke::Signal
    def run
      one_minute, five_minutes, fifteen_minutes = %x[uptime].strip.split(/load averages: /).last.split(/ /)
      {
        :report => {
          :one_minute => one_minute.to_f,
          :five_minutes => five_minutes.to_f,
          :fifteen_minutes => fifteen_minutes.to_f
        }
      }
    end
  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
smoke-0.0.3 contrib/signals/smoke/system_load.rb