Giter Site home page Giter Site logo

heartcheck's Introduction

Heartcheck

Heartcheck is a monitoring tool for Rack applications. It provides a DSL to declare service checks and an URI that returns the status for each service. With this gem you can monitor if your app has access to the database, a cache service, an API, etc.

Build Status Code Climate Ebert

Installation

Add this line to your application's Gemfile:

gem 'heartcheck'

And then execute:

$ bundle

Or install it yourself as:

$ gem install heartcheck

Usage

First generate the config file for the framework you are using:

$ heartcheck rails
$ heartcheck padrino
$ heartcheck sinatra

Then edit the generated file by adding your checks on it and restart your server. Now you should be able to make a HTTP request for /monitoring and get a JSON response that contains the status for each monitored service.

The following environment variables are needed by heartcheck:

HEARTCHECK_APP_NAME=MyApplicationName

Using built-in checks

Firewall check

Heartcheck.setup do |config|
  config.add :firewall do |c|
    c.add_service(host: 'domain.com', port: 80)
    c.add_service(host: 'domain.com', port: 80, timeout: 5) # Default timeout is 2 seconds
    c.add_service(url: 'https://domain.com')
    c.add_service(url: 'https://domain.com', proxy: 'http://proxy.domain.com')
  end
end

HTTP Routes

Basic health check

To get the status for all services, make a HTTP request for the following URI:

/monitoring

It will return a JSON response and a status for each service.

Functional status

Functional services are services essential for your application. You can get their status using the following route:

/monitoring/functional

Info route

This route returns custom information about your app. You can configure it to return whatever information you want:

/monitoring/info

Dev status

Returns some debugging information:

/monitoring/dev

Very basic health check

Returns a simple ok if the app is running. It does not execute any configured checks:

/monitoring/health_check

General info and dependencies

Returns general application info and a list of dependencies' URIs, but executes no checking:

/monitoring/inspect

Response formatting

An optional formatter may be set for the monitoring response. We provide the default format using a list of hashes and one with a single Hash. Please check Heartcheck.use_hash_formatter!

Plugins

Contributing

Bug reports and pull requests are welcome on GitHub at https://github.com/locaweb/heartcheck.

Docker

Heartcheck can be setup with Docker and Docker Compose on macOS or Linux systems, so that you don't need to install ruby and it's dependencies via rbenv or rvm.

Just do your setup locally by running:

./scripts/heartcheck setup

Run ./scripts/heartcheck -h to see available options, such as bash, rspec, etc.

heartcheck's People

Contributors

anakinj avatar andrerocker avatar angeliski avatar brunoadacosta avatar dlisboa avatar fabioperrella avatar feolea avatar lenon avatar lorn avatar luizcavalcanti avatar marciotrindade avatar pmnhaes avatar pothix avatar razanjoshi avatar rhruiz avatar ricardotealdi avatar rogesson avatar spires12 avatar tecnosigma avatar victorsna avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

heartcheck's Issues

Eu sou Designer Gráfico

Oi boa tarde, sou um designer gráfico e adoraria contribuir com esse projeto usando minhas habilidades, e outros projetos da Locaweb também, eu tenho interesse em contribuir, como posso entrar em contato com vocês?

Muito obrigado pela atenção!

Problema na instalação com sinatra

Realizei o comando abaixo e tive o seguinte resultado:

heartcheck sinatra
/home/marcelosilva/workspace/iaas/iaas-notifications-api/vendor/bundle/ruby/2.1.0/gems/heartcheck-1.0.3/lib/heartcheck/generators/generator.rb:1:in require': cannot load such file -- thor/group (LoadError) from /home/marcelosilva/workspace/iaas/iaas-notifications-api/vendor/bundle/ruby/2.1.0/gems/heartcheck-1.0.3/lib/heartcheck/generators/generator.rb:1:in<top (required)>'
from /home/marcelosilva/workspace/iaas/iaas-notifications-api/vendor/bundle/ruby/2.1.0/gems/heartcheck-1.0.3/lib/heartcheck/generators.rb:1:in require' from /home/marcelosilva/workspace/iaas/iaas-notifications-api/vendor/bundle/ruby/2.1.0/gems/heartcheck-1.0.3/lib/heartcheck/generators.rb:1:in<top (required)>'
from /home/marcelosilva/workspace/iaas/iaas-notifications-api/vendor/bundle/ruby/2.1.0/gems/heartcheck-1.0.3/bin/heartcheck:8:in require' from /home/marcelosilva/workspace/iaas/iaas-notifications-api/vendor/bundle/ruby/2.1.0/gems/heartcheck-1.0.3/bin/heartcheck:8:in<top (required)>'
from /home/marcelosilva/workspace/iaas/iaas-notifications-api/vendor/bundle/ruby/2.1.0/bin/heartcheck:23:in load' from /home/marcelosilva/workspace/iaas/iaas-notifications-api/vendor/bundle/ruby/2.1.0/bin/heartcheck:23:in

'

oj has been updated and heartcheck is holding me back!

oj had a minor version update recently and heartcheck is depending on the old version.

Should we depend on oj? Can't we just use multi_json? Or even "native" json? Do we really have humongous json payloads to encode?

Allow rubocop to run in more paths

Hey, seems that rubocop is not being execute in anywhere else than **/Rakefile!

To increase quality we need help to execute it in others paths (except for spec folder), and fix the offenses from it!

It is logging blank lines when it isn`t needed

Issue Template

Prerequisites

Please answer the following questions for yourself before submitting an issue. YOU MAY DELETE THE PREREQUISITES SECTION.

  • I am running the latest version
  • I checked the documentation and found no answer
  • I checked to make sure that this issue has not already been filed
  • I'm reporting the issue to the correct repository (for multi-repository projects)

Context

I am receiving empty lines of log in my log collector (I am using ELK), and I want to avoid it due to the possibility of ignoring false negatives for bugs in my logs

  • Tag version realease:

Expected Behavior

Log contents, no blanks

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.