Class: Pingdom::Summary::Performance
- Defined in:
- lib/pingdom/summary/performance.rb
Overview
summary.performance includeuptime resolution=day “downtime”=>0, “starttime”=>1297238400, “uptime”=>86400, “avgresponse”=>234,
{"unmonitored"=>0, "downtime"=>0, "starttime"=>1297324800, "uptime"=>86400, "avgresponse"=>215},
{"unmonitored"=>0, "downtime"=>2648, "starttime"=>1297411200, "uptime"=>83752, "avgresponse"=>211},
{"unmonitored"=>0, "downtime"=>0, "starttime"=>1297497600, "uptime"=>86400, "avgresponse"=>207},
{"unmonitored"=>0, "downtime"=>330, "starttime"=>1297584000, "uptime"=>86070, "avgresponse"=>228},
{"unmonitored"=>0, "downtime"=>0, "starttime"=>1297670400, "uptime"=>86400, "avgresponse"=>236},
{"unmonitored"=>0, "downtime"=>0, "starttime"=>1297756800, "uptime"=>86400, "avgresponse"=>230},
{"unmonitored"=>0, "downtime"=>0, "starttime"=>1297843200, "uptime"=>86400, "avgresponse"=>256},
{"unmonitored"=>0, "downtime"=>0, "starttime"=>1297929600, "uptime"=>86400, "avgresponse"=>216},
{"unmonitored"=>0, "downtime"=>0, "starttime"=>1298016000, "uptime"=>86400, "avgresponse"=>251},
{"unmonitored"=>0, "downtime"=>0, "starttime"=>1298102400, "uptime"=>8646, "avgresponse"=>223}]}
Constant Summary collapse
- INTERVALS =
{ "hour" => 1.hour, "day" => 1.day, "week" => 1.week }
Class Method Summary collapse
Instance Method Summary collapse
- #downtime ⇒ Object
- #endtime ⇒ Object (also: #end_at)
- #monitored ⇒ Object
- #period ⇒ Object
- #starttime ⇒ Object (also: #start_at)
- #unmonitored ⇒ Object
- #uptime ⇒ Object
Methods inherited from Base
attributes, check_error!, #id, #initialize, #inspect, #method_missing, #respond_to?
Constructor Details
This class inherits a constructor from Pingdom::Base
Dynamic Method Handling
This class handles dynamic methods through the method_missing method in the class Pingdom::Base
Class Method Details
.parse(client, response) ⇒ Object
23 24 25 26 27 28 29 30 31 32 |
# File 'lib/pingdom/summary/performance.rb', line 23 def self.parse(client, response) body = super[:summary] interval = body.keys.detect{ |k| INTERVALS.keys.include?(k.chomp('s').to_s) }.chomp('s').to_sym intervals = body[interval.to_s.pluralize] intervals.map do |perf| perf[:interval] = interval new(client, response, perf) end end |
Instance Method Details
#downtime ⇒ Object
47 48 49 |
# File 'lib/pingdom/summary/performance.rb', line 47 def downtime @attributes[:downtime].seconds end |
#endtime ⇒ Object Also known as: end_at
39 40 41 |
# File 'lib/pingdom/summary/performance.rb', line 39 def endtime starttime + INTERVALS[interval.to_s].to_i end |
#monitored ⇒ Object
53 54 55 |
# File 'lib/pingdom/summary/performance.rb', line 53 def monitored uptime + downtime end |
#period ⇒ Object
56 57 58 |
# File 'lib/pingdom/summary/performance.rb', line 56 def period monitored + unmonitored end |
#starttime ⇒ Object Also known as: start_at
34 35 36 |
# File 'lib/pingdom/summary/performance.rb', line 34 def starttime Time.at(@attributes[:starttime]) end |
#unmonitored ⇒ Object
50 51 52 |
# File 'lib/pingdom/summary/performance.rb', line 50 def unmonitored @attributes[:unmonitored].seconds end |
#uptime ⇒ Object
44 45 46 |
# File 'lib/pingdom/summary/performance.rb', line 44 def uptime @attributes[:uptime].seconds end |