Module: Bixby::Metrics

Defined in:
lib/bixby-client/modules/metrics.rb

Class Method Summary collapse

Class Method Details

.put_check_result(results) ⇒ void

This method returns an undefined value.

Store the results of one or more Checks. Each result may contain multiple metrics.

Fires the :put_check_result hook on completion, passing results as the only param.

Example input:

{
  "status"    => "OK",
  "timestamp" => 1329775841,
  "key"       => "hardware.storage.disk",
  "check_id"  => "77",
  "metrics" => [
    {
      "metrics"  => { "size"=>297, "used"=>202, "free"=>94, "usage"=>69 },
      "metadata" => { "mount"=>"/", "type"=>"hfs" }
    }
  ],
  "errors"=>[]
}

Parameters:

  • results (Array<Hash>)

    An array of results from one or more checks

Options Hash (results):

  • :check_id (Fixnum)
  • :key (String)

    base key name

  • :status (String)

    OK, WARNING, CRITICAL, UNKNOWN, TIMEOUT

  • :timestamp (Fixnum)
  • :metrics (Array)
    • Hash

      :metrics key/value pairs

    • Hash

      :metadata key/value pairs

  • :errors (Array<String>)

    list of errors, if any



37
38
39
40
# File 'lib/bixby-client/modules/metrics.rb', line 37

def self.put_check_result(results)
  req = JsonRequest.new("metrics:put_check_result", [ results ])
  return Bixby.client.exec_api(req)
end