0.0
No commit activity in last 3 years
No release in over 3 years
When monitoring REST servers it is useful to have a standard /status page. This gem provides such content.
2005
2006
2007
2008
2009
2010
2011
2012
2013
2014
2015
2016
2017
2018
2019
2020
2021
2022
2023
2024
 Dependencies

Development

Runtime

 Project Readme

Service::Status

Build Status Code Climate Test Coverage Gem Version Gem Dependency

Provides an object representing the status of a service, suitable for exposing as JSON as part of a REST api.

Installation

Add this line to your application's Gemfile:

gem 'service-status'

And then execute:

$ bundle

Or install it yourself as:

$ gem install service-status

Usage

status = ServiceStatus::Status.new("windows", '3.11', boot_time)
# boot_time is time the app was started

# check that we can connect to redis
redis_ok = true
begin
	Redis.new.ping
rescue
	redis_ok = false
end

#Last argument 'description' is optional
status.add_check('redis', redis_ok, 'Can connect to Redis')

#Last argument 'description' is optional
status.add_stat('request_count', 100, 'Number of Requests')

JSON.pretty_generate(status)             # render as JSON as required

Format

As below. Checks are always part of the 'checks' array. If they have failed, they are included in 'errors' as well.

'Status' is either "online" or "offline".

{
  "name": "windows",
  "version": "3.11",
  "hostname": "clippy",
  "stats": [{
    "name": "request_count",
    "value": 100,
    "description": "Number of Requests"
  }],
  "checks": [{
    "name": "redis",
    "successful": true
    "description": "Can connect to Redis"
  }],
  "timestamp": "2015-05-07 14:35:17",
  "uptime": "14d:23:11:21",
  "diskusage": "64%",
  "status": "online"
}

Contributing

  1. Fork it ( https://github.com/[my-github-username]/service-status/fork )
  2. git flow init -d (assuming you have git flow)
  3. Create your feature branch (git flow feature start my-new-feature)
  4. Commit your changes (git commit -am 'Add some feature')
  5. Push to the branch (git push origin feature/my-new-feature)
  6. Create a new Pull Request

Copyright

Copyright (c) 2015 The Book People

See LICENSE (GPLv3)