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, }.freeze
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?, #respond_to_missing?
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
22 23 24 25 26 27 28 29 30 31 |
# File 'lib/pingdom/summary/performance.rb', line 22 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
38 39 40 |
# File 'lib/pingdom/summary/performance.rb', line 38 def endtime starttime + INTERVALS[interval.to_s].to_i end |
#monitored ⇒ Object
55 56 57 |
# File 'lib/pingdom/summary/performance.rb', line 55 def monitored uptime + downtime end |
#period ⇒ Object
59 60 61 |
# File 'lib/pingdom/summary/performance.rb', line 59 def period monitored + unmonitored end |
#starttime ⇒ Object Also known as: start_at
33 34 35 |
# File 'lib/pingdom/summary/performance.rb', line 33 def starttime Time.at(@attributes["starttime"]) end |
#unmonitored ⇒ Object
51 52 53 |
# File 'lib/pingdom/summary/performance.rb', line 51 def unmonitored @attributes["unmonitored"].seconds end |
#uptime ⇒ Object
43 44 45 |
# File 'lib/pingdom/summary/performance.rb', line 43 def uptime @attributes["uptime"].seconds end |