No release in over 3 years
Low commit activity in last 3 years
Plugin to check webservice connection in heartcheck.
2005
2006
2007
2008
2009
2010
2011
2012
2013
2014
2015
2016
2017
2018
2019
2020
2021
2022
2023
2024
2025
 Dependencies

Development

>= 1.3.0, ~> 1.3.0
~> 0.2.0, >= 0.2.4
>= 0
~> 3.2.0, >= 3.2.2
>= 3.1.0, ~> 3.1.0
~> 0.52.0
~> 0.9.0

Runtime

 Project Readme

Heartcheck::Webservice

Build Status Ebert

A plugin to check webservice connection with heartcheck

Installation

Add this line to your application's Gemfile:

gem 'heartcheck-webservice'

And then execute:

$ bundle

Or install it yourself as:

$ gem install heartcheck-webservice

Usage

You can add a check to a webservice when configuring heartcheck

The service is a Hash that needs to respond to :name to identify the service and :url of the service (GET request). Ex.

Heartcheck.setup do |config|
  config.add :webservice do |c|
    c.add_service(name: 'CloudApi', url: "http://cloud.example.com/status")
  end
end

Other available options for the service Hash

  • body_match
    • A regex that is going to match the response body
  • ignore_ssl_cert
    • When set to true the SSL certificate won't be verified
  • open_timeout
    • Number of seconds to wait for the connection to open
  • read_timeout
    • Number of seconds to wait for one block to be read

Here is an example using all available options:

Heartcheck.setup do |config|
  config.add :webservice do |c|
    c.add_service(name: 'CloudApi',
                  url: "https://cloud.example.com/status",
                  proxy: "10.20.30.40:8888",
                  headers: { "MY-API-KEY" => "abc123" },
                  body_match: /OK/,
                  ignore_ssl_cert: true,
                  open_timeout: 2,
                  read_timeout: 60)
  end
end

Default values

Option Value
open_timeout 3s
read_timeout 5s
ignore_ssl_cert false

Development setup using Docker

The Docker Hearthcheck-Webservice provides a container with the current stable version of Ruby and requires you to have these tools available in your local environment:

BootStrap Script to run the dockerized environment

./scripts/heartcheck-resque setup

Run the command ./scripts/heartcheck-webservice -h to see available options.

Contributing

  1. Fork it
  2. Create your feature branch ( git checkout -b my-new-feature )
  3. Commit your changes ( git commit -am 'Add some feature' )
  4. Push to the branch ( git push origin my-new-feature )
  5. Create a new Pull Request

License