Pingdom Uptime
==============
![](preview.png)
### Requirement
The smile face requires font-awesome >= 4.1.0. dashing-contrib includes 4.1.0 CSS and load font from CDN. You can safely delete the fonts folder and font-awesome css files in generated dashing asset folder.
### Example html usage
```html
```
### Example job
This also shows a coupld of dashing-contrib data APIs for pingdom.
```ruby
# Some helper methods for pingdom
require 'dashing-contrib/bottles/pingdom'
SCHEDULER.every '30s' do
nowTime = Time.now.to_i
t1_month = 86400 * 30
# 24 hours
defaultDateRange = nowTime - 86400
# 4 months ago
firstDateRange = nowTime - (t1_month * 4)
# 1 year to date
secondDateRange = nowTime - (t1_month * 12)
client = DashingContrib::Pingdom::Client.new(
username: ENV['PINGDOM_USERNAME'],
password: ENV['PINGDOM_PASSWORD'],
api_key: ENV['PINGDOM_API_KEY']
)
# checks id provided by pingdom
id = '1234432'
current_uptime = client.uptime(id, defaultDateRange, nowTime)
first_uptime = client.uptime(id, firstDateRange, nowTime)
second_uptime = client.uptime(id, secondDateRange, nowTime)
status = client.checks(id)
data = {
current: current_uptime.to_s,
first: first_uptime.to_s,
first_title: '4 Months',
second: second_uptime.to_s,
second_title: 'YTD',
is_up: status[:check][:status] == 'up',
current_response_time: status[:check][:lastresponsetime],
last_downtime: ::DashingContrib::Time.readable_diff(::Time.at(status[:check][:lasterrortime]))
}
send_event("pingdom-uptime", data)
end
```