Giter Site home page Giter Site logo

lbeder / health-monitor-rails Goto Github PK

View Code? Open in Web Editor NEW
213.0 5.0 59.0 612 KB

A Rails plugin which provides a health checking and monitoring API of various services and application aspects.

License: MIT License

Ruby 88.33% JavaScript 0.80% CSS 0.62% HTML 10.24%

health-monitor-rails's Introduction

health-monitor-rails

Gem Version Build Status Coverage Status

This is a health monitoring Rails mountable plug-in, which checks various services (db, cache, sidekiq, redis, etc.).

Mounting this gem will add a '/check' route to your application, which can be used for health monitoring the application and its various services. The method will return an appropriate HTTP status as well as an HTML/JSON/XML response representing the state of each provider.

You can filter which checks to run by passing a parameter called providers.

Examples

HTML Status Page

alt example

JSON Response

>> curl -s http://localhost:3000/check.json | json_pp
{
   "timestamp" : "2017-03-10 17:07:52 +0200",
   "status" : "ok",
   "results" : [
      {
         "name" : "Database",
         "message" : "",
         "status" : "OK"
      },
      {
         "status" : "OK",
         "message" : "",
         "name" : "Cache"
      },
      {
         "status" : "OK",
         "message" : "",
         "name" : "Redis"
      },
      {
         "status" : "OK",
         "message" : "",
         "name" : "Sidekiq"
      }
   ]
}

Filtered JSON Response

>> curl -s http://localhost:3000/check.json?providers[]=database&providers[]=redis | json_pp
{
   "timestamp" : "2017-03-10 17:07:52 +0200",
   "status" : "ok",
   "results" : [
      {
         "name" : "Database",
         "message" : "",
         "status" : "OK"
      },
      {
         "status" : "OK",
         "message" : "",
         "name" : "Redis"
      },
   ]
}

XML Response

>> curl -s http://localhost:3000/check.xml
<?xml version="1.0" encoding="UTF-8"?>
<hash>
  <results type="array">
    <result>
      <name>Database</name>
      <message></message>
      <status>OK</status>
    </result>
    <result>
      <name>Cache</name>
      <message></message>
      <status>OK</status>
    </result>
    <result>
      <name>Redis</name>
      <message></message>
      <status>OK</status>
    </result>
    <result>
      <name>Sidekiq</name>
      <message></message>
      <status>OK</status>
    </result>
  </results>
  <status type="symbol">ok</status>
  <timestamp>2017-03-10 17:08:50 +0200</timestamp>
</hash>

Filtered XML Response

>> curl -s http://localhost:3000/check.xml?providers[]=database&providers[]=redis
<?xml version="1.0" encoding="UTF-8"?>
<hash>
  <results type="array">
    <result>
      <name>Database</name>
      <message></message>
      <status>OK</status>
    </result>
    <result>
      <name>Redis</name>
      <message></message>
      <status>OK</status>
    </result>
  </results>
  <status type="symbol">ok</status>
  <timestamp>2017-03-10 17:08:50 +0200</timestamp>
</hash>

Setup

If you are using bundler add health-monitor-rails to your Gemfile:

gem 'health-monitor-rails'

Then run:

bundle install

Otherwise, install the gem:

gem install health-monitor-rails

Usage

You can mount this inside your app routes by adding this to config/routes.rb:

mount HealthMonitor::Engine, at: '/'

Supported Service Providers

The following services are currently supported:

  • DB
  • Cache
  • Redis
  • Sidekiq
  • Resque
  • Delayed Job
  • Solr

Configuration

Adding Providers

By default, only the database check is enabled. You can add more service providers by explicitly enabling them via an initializer:

HealthMonitor.configure do |config|
  config.cache
  config.redis
  config.sidekiq
  config.delayed_job
end

We believe that having the database check enabled by default is very important, but if you still want to disable it (e.g., if you use a database that isn't covered by the check) - you can do that by calling the no_database method:

HealthMonitor.configure do |config|
  config.no_database
end

Provider Configuration

All providers accept a general set of baseline configuration:

HealthMonitor.configure do |config|
  config.[provider].configure do |provider_config|
    provider_config.name = 'Redis'
    provider_config.critical = true
  end
end
  • name: Custom name for the provider (Defaults to class name. Ex: 'Redis', 'Sidekiq')
  • critical: Whether or not the provider is a critical dependency (Defaults to: true). If set to false, the monitor will report its status but ignore it when determining overall application health status

The critical option allows you to monitor for additional non-critical dependencies that are not fully required for your application to be operational, like a cache database for instance

Some of the providers can also accept additional configuration:

# Sidekiq
HealthMonitor.configure do |config|
  config.sidekiq.configure do |sidekiq_config|
    sidekiq_config.latency = 3.hours
    sidekiq_config.queue_size = 50
  end
end

# Sidekiq with specific queues
HealthMonitor.configure do |config|
  config.sidekiq.configure do |sidekiq_config|
    sidekiq_config.add_queue_configuration('critical', latency: 10.seconds, queue_size: 20)
  end
end
# Redis with existing connection
HealthMonitor.configure do |config|
  config.redis.configure do |redis_config|
    redis_config.connection = Redis.current # Use your custom redis connection
    redis_config.max_used_memory = 200 # Megabytes
  end
end

Additionally, you can configure an explicit URL:

# Redis with a URL configuration
HealthMonitor.configure do |config|
  config.redis.configure do |redis_config|
    redis_config.url = 'redis://user:[email protected]:90210/'
    redis_config.max_used_memory = 200
  end
end

Or via a connection pool:

# Redis using Connection Pools
HealthMonitor.configure do |config|
  config.redis.configure do |redis_config|
    redis_config.connection = ConnectionPool.new(size: 5) { Redis.new } # Use your custom connection pool
  end
end

For providers that can be configured with its endpoits/urls you can also add multiple declarations to ensure you are reporting across all dependencies:

HealthMonitor.configure do |config|
  config.redis.configure do |c|
    c.name = 'Redis: Cache'
    c.url = ENV.fetch('REDISCLOUD_URL', 'redis://localhost:6379/0')
  end
  config.redis.configure do |c|
    c.name = 'Redis: Action Cable'
    c.url = ENV.fetch('REDISCLOUD_URL', 'redis://localhost:6379/0')
  end
  config.redis.configure do |c|
    c.name = 'Redis: Sidekiq'
    c.url = ENV.fetch('REDISCLOUD_URL', 'redis://localhost:6379/1')
  end
end

The currently supported settings are:

Sidekiq

  • latency: the latency (in seconds) of a queue (now - when the oldest job was enqueued) which is considered unhealthy (the default is 30 seconds, but larger processing queue should have a larger latency value).
  • queue_size: the size (maximum) of a queue which is considered unhealthy (the default is 100).
  • default_queue: the default queue to check.
  • add_queue_configuration: add specific configuration per queue.

Redis

  • url: the URL used to connect to your Redis instance. Note, that this is an optional configuration and will use the default connection if not specified. You can also use url to explicitly configure authentication (e.g., 'redis://user:[email protected]:90210/').
  • connection: Use custom Redis connection (e.g., Redis.current).
  • max_used_memory: Set maximum expected memory usage of Redis in megabytes. Prevent memory leaks and keys over storing.

Please note that url or connection can't be used at the same time.

Delayed Job

  • queue_size: the size (maximum) of a queue which is considered unhealthy (the default is 100).

Solr

  • url: the URL used to connect to your Solr instance - must be a string. You can also use url to explicitly configure authentication (e.g., 'https://user:[email protected]:8983/')
  • collection: An optional parameter used to connect to your specific Solr collection - must be a string. By setting this parameter the code will check the status of this individual collection in your Solr instance instead of just the status of the overall Solr instance

Adding a Custom Provider

It's also possible to add custom health check providers suited for your needs (of course, it's highly appreciated and encouraged if you'd contribute useful providers to the project).

To add a custom provider, you'd need to:

  • Implement the HealthMonitor::Providers::Base class and its check! method (a check is considered as failed if it raises an exception):
class CustomProvider < HealthMonitor::Providers::Base
  def check!
    raise 'Oh oh!'
  end
end
  • Add its class to the configuration:
HealthMonitor.configure do |config|
  config.add_custom_provider(CustomProvider)
end

Adding a Custom Error Callback

If you need to perform any additional error handling (for example, for additional error reporting), you can configure a custom error callback:

HealthMonitor.configure do |config|
  config.error_callback = proc do |e|
    logger.error "Health check failed with: #{e.message}"

    Raven.capture_exception(e)
  end
end

Adding Authentication Credentials

By default, the /check endpoint is not authenticated and is available to any user. You can authenticate using HTTP Basic Auth by providing authentication credentials:

HealthMonitor.configure do |config|
  config.basic_auth_credentials = {
    username: 'SECRET_NAME',
    password: 'Shhhhh!!!'
  }
end

Adding Environment Variables

By default, environment variables are nil, so if you'd want to include additional parameters in the results JSON, all you need is to provide a Hash with your custom environment variables:

HealthMonitor.configure do |config|
  config.environment_variables = {
    build_number: 'BUILD_NUMBER',
    git_sha: 'GIT_SHA'
  }
end

Customizing the path

By default, the endpoint where the status page is served is /check, but this can be customized:

HealthMonitor.configure do |config|
  config.path = :status
end

This will make the page to be served in the /status endpoint for instance (from where the engine was mounted).

Monitoring Script

A Nagios/Shinken/Icinga/Icinga2 plugin is available in extra directory.

It takes one argument: -u or --uri

nicolas@desktop:$ ./check_rails.rb
missing argument: uri

Usage: check_rails.rb -u uri
    -u, --uri URI                    The URI to check (https://nagios:[email protected]/check.json)

Common options:
    -v, --version                    Displays Version
    -h, --help                       Displays Help

Also, it generates an output with the right status code for your monitoring system:

nicolas@desktop:$ ./check_rails.rb -u http://admin:admin@localhost:5000/check.json
Rails application : OK

Database : OK
Cache : OK
Redis : OK
Sidekiq : OK

nicolas@desktop:$ echo $?
0
nicolas@desktop:$ ./check_rails.rb -u http://admin:admin@localhost:5000/check.json
Rails application : ERROR

Database : OK
Cache : OK
Redis : ERROR (Error connecting to Redis on 127.0.0.1:6379 (Errno::ECONNREFUSED))
Sidekiq : ERROR (Error connecting to Redis on 127.0.0.1:6379 (Errno::ECONNREFUSED))

nicolas@desktop:$ echo $?
2

Development

In order to work on development on the gem itself

Installing the gems

Use the appraisal gem to install the bundles for different rails versions:

appraisal clean
appraisal generate
appraisal install

Running the tests

Use appraisal to run the tests using rake

appraisal rake

License

The MIT License (MIT)

Copyright (c) 2017

Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:

The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.

health-monitor-rails's People

Contributors

carolyncole avatar danielnc avatar etetzlaff avatar gui avatar jayceekay avatar joshdvir avatar kolo avatar lbeder avatar loed-idzinga avatar maxkadel avatar n-rodriguez avatar orangewolf avatar rmm5t avatar shettytejas avatar sliiser avatar tsaifi9 avatar yorch 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  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  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

health-monitor-rails's Issues

Add support for multiple same type providers.

For example, I want to check the sidekiq of redis and the redis of cache separately.

HealthMonitor.configure do |config|
  config.redis.configure do |c|
    c.connection = Redis.current
    c.provider_name = 'Redis(Cache)'
    c.max_used_memory = 200
  end

  config.redis.configure do |c|
    c.connection = Sidekiq.configure_server.redis
    c.provider_name = 'Redis(Sidekiq)'
    c.max_used_memory = 200
  end
end

Always HTTP 200?

The response code for the health check pages always returns an HTTP 200 success code even if one of the providers fails its health check.

This surprised me. I expected a 500 error if one of the underlying providers had an error. Same body response, but a different response code.

Thoughts?

Support a connection pool for Redis

Redis now recommends using a connection pool so it would be great to have support for that here.

We should then not need to close connections as the connection pool should handle all of this for us.

I wrote small wrapper class that makes my Rails app work with the existing Redis check.

class RedisPoolClientHelper
  def close; end

  def get(key)
    pool.with { |c| c.get(key) }
  end

  def set(key, value)
    pool.with { |c| c.set(key, value) }
  end

  private

  def pool
    REDIS_CONNECTION_POOL # This is defined in my redis initializer
  end
end

# config/initializers/health-monitor.rb
Rails.application.config.after_initialize do
  HealthMonitor.configure do |config|
      config.redis.configure do |redis_config|
        redis_config.connection = RedisPoolClientHelper.new
      end
    end
end
   

database check doesn't work for mongoid, and can't be turned off

Rails 5 app using mongoid for the DB. The current database check doesn't work for mongoid. I plan to work on a PR to add a mongoid check, but my issue is that because the database check is on by default and the check fails mongoid, my health check always fails.

I think having the database check by default makes sense, but we need a way to disable it if needed.

Tried to creating a new "database" check to see if it would override it in the list, but that simply produces 2 DB checks.

Monitoring script

I've got a Ruby script ready to eat health-monitor-rails json output.
It's compatible with Nagios / Shinken / Icinga / Icinga2.
Would you like a PR to add it in a contrib or extra directory?

Sidekiq reading OK when inactive

Hi!

Excellent gem you have here. I actually stumbled upon it from rails-engine/status-page. I was planning to use status-page; however, it looks like health-monitor-rails has been a little better maintained. I was testing them side by side and noticed that when I shut down my Sidekiq instance, status-page reports an error with Sidekiq not having any active instances, while health-monitor-rails continues to report OK. A cursory glance at the sidekiq.rb files between the two shows that status-page raises an error when processes.size == 0, while health-monitor-rails does not.

Two questions:
What should health-monitor-rails display when Sidekiq is not enabled?
What, if any, other differences are there between the two gems?

Thanks!

HealthMonitor::Providers::SidekiqException · undefined method `queues' for nil:NilClass

I ran into a weird issue where sidekiq was throwing this error. HealthMonitor::Providers::SidekiqException · undefined method queues' for nil:NilClass`

This was my config.

HealthMonitor.configure do |config|
  config.cache
  config.sidekiq

  config.error_callback = proc do |error|
    Rails.logger.error "Health check failed with: #{error.message}"

    Bugsnag.notify error do |report|
      report.severity = 'error'
    end
  end
end

However, if I update my config to use a latency, even the default, then it passes just fine. Any thoughts?

HealthMonitor.configure do |config|
  config.cache
  config.sidekiq
  config.sidekiq.configure do |sidekiq_config|
    sidekiq_config.latency = 30
  end

  config.error_callback = proc do |error|
    Rails.logger.error "Health check failed with: #{error.message}"

    Bugsnag.notify error do |report|
      report.severity = 'error'
    end
  end
end

image

Can't login redis with password auth only

Hello!,

Good day! this gem is really helpful, however i am currently facing issues connecting redis with password only auth:

Screen Shot 2019-09-23 at 11 01 43 PM

Anyhow, Sidekiq returns "Error" if redis is down which is great, that indicates there's a connection issue.

What is the correct settings for config.redis_url? I followed the instructions in README markdown but it won't work still says NO AUTH. Authentication required

Running Redis 5 >, sidekiq 6

Redis client is nil

My configuration as:

HealthMonitor.configure do |config|
  config.database
  config.cache
  config.sidekiq
  config.sidekiq.configure do |sidekiq_config|
    sidekiq_config.latency = 1.minute
  end

  config.redis
  if ENV['REDIS_URL']
    config.redis.configure do |redis_config|
      redis_config.url = ENV['REDIS_URL']
    end
  end
end

Brings redis error:
undefined method client' for nil:NilClass`

In development environment i use local redis, but for staging and production I extract redis url from ENV.

2017-12-22 11 57 13

Gem correct working with Memcached?

Hi.
When we drop our memcache server
check.json responds what it is ok.

    {
      "name": "Cache",
      "message": "",
      "status": "OK"
    }

It is correct behaviour? Or maybe not?
Any advices for correct watch status of memcache? Thank u.

💡Optionally show response times

It could be really nice to show response times for each health check. If the page takes several seconds to load I would like to know which services were slow to respond.

Time#to_s(:rfc2822) is deprecated

Hey ,
There's deprecation warning causing some issues on one of my apps. Gem version is 9.0 (latest).

This breaks with Rails 7.

Do you plan to continue supporting this gem?
Is this repo still active?

Best,

DEPRECATION WARNING: Time#to_s(:rfc2822) is deprecated. Please use Time#to_formatted_s(:rfc2822) instead. (called from check_values! at /vendor/ruby/2.7.0/gems/health-monitor-rails-9.0.0/lib/health_monitor/providers/redis.rb:40)"}
{"host":"roguetwo.local","timestamp":"2021-12-20T22:13:53.720721Z","level":"warn","level_index":3,"name":"Rails","message":"DEPRECATION WARNING: Time#to_s(:rfc2822) is deprecated. Please use Time#to_formatted_s(:rfc2822) instead. (called from check at /vendor/ruby/2.7.0/gems/health-monitor-rails-9.0.0/lib/health_monitor/monitor.rb:32)"}

Unintialized Constant Error

I have followed the exact instructions to add the gem from the README file but I am getting the following error.

uninitialized constant HealthMonitor (NameError)

I have added it to a Rails api-only application. My Ruby version is 2.6.2 and Rails version is ~> 5.2.3

Is this supposed to work with only a full-Rails application, and not an api?

check.json schema

Hi,

Quick question, is it possible to customize the output schema json? like let say i wanted to change the OK to UP

Make mount url configurable

Hi there!

It would be nice to make the mount url configurable :

mount HealthMonitor::Engine, at: '/check'

instead of

mount HealthMonitor::Engine, at: '/'

Help with configuring

Hi there!

This looks like an excellent library for what I want to do, I just have a couple questions.

  1. Where do I add the HealthMonitor.configure block? does that go in routes.rb?
  2. How can I add custom messages to different settings, such as if the database is unavailable, or redis is non-responsive?
  3. For basic auth, is it possible to use an API key token instead? If not, would I have to pass the user/pass in the URI request, such as testsite.com/check?user=USER?password=PASSWORD?

Thanks for the help!

-Stu

Redis memory usage

Also would be nice to have quick review of Redis memory usage and alert if it increase more that configured values (1Gb in my current case)

Can I contribute this ?

Redis & Sidekiq nil:NilClass errors

I've got both Redis and Sidekiq running, I can access sidekiq via my rails applications, however both of the items on the health check page return an error.

For Sidekiq the error is: undefined method 'latency' for nil:NilClass

For Redis the error is: undefined method 'connection' for nil:NilClass

Both are definitely running. Via the console I can get the latency on a queue, without any issues. The same goes for Redis, I can call Redis.current.connection and it works just fine. So not sure why it fails for the health check page.

Sidekiq - Queue nil error

Thanks for sharing this gem.

I encounter an issue with the sidekiq check. I receive the following error in the status page.

ERROR
undefined method `queues' for nil:NilClass configuration.queues.each do |queue, config| ^^^^^^^

When I manually define the queues to monitor, the problem goes away:

sidekiq_config.add_queue_configuration("critical", latency: 10.seconds, queue_size: 20)
sidekiq_config.add_queue_configuration("low", latency: 10.seconds, queue_size: 20)

Based on the readme I thought it would work ootb without the specific queue definition.

Versions
Ruby    3.1.0
Sidekiq 6.4.1
Rails   7.0.3

SyntaxError in monitor.rb under Rails 4.2

I'm running Rails 4.2 and get the following error:

/health-monitor-rails-8.6.1/lib/health_monitor/monitor.rb:48: syntax error, unexpected '.' (SyntaxError)
    configuration.error_callback&.call(e)

If I switch to using version 8.6.0 of the gem then the error does not occur.

DB Provider doesn't detect a dropped DB connection (ie. killing the db)

I'm not sure if this is meant to be detected but I noticed that when I manually stop the db, ie. by killing the process or stopping the container, the default DB provider doesn't detect it. You can see that here on my local (you might have to pop out the GIF to see the text, and I'm not sure why this gif is so fast - I can recreate it if we need a slower version):

health-monitor

Using docker compose I've repro'd it here: https://github.com/jayceekay/health-monitor-repro. Just run docker compose up, docker ps to find the postgres container, then docker stop [sha-for-postgres] to bring down the DB

undefined method 'configure' for HealthMonitor:Module

For my initializers/health_monitor.rb

Rails.application.config.after_initialize do
	HealthMonitor.configure do |config|
  	config.basic_auth_credentials = {
    	username: 'SECRET_NAME',
    	password: 'Shhhhh!!!'
  	}
  end
end

I'm getting the following error:

config/initializers/health_monitor.rb:2:in block in <top (required)>': undefined method configure' for HealthMonitor:Module (NoMethodError)

Wrong provider config memoization

I configure my redis provider in initializer as shown in documentation

HealthMonitor.configure do |config|
  config.redis.configure do |redis_config|
    redis_config.url = 'redis://user:[email protected]:90210/'
  end
end

But i have error:
Error connecting to Redis on 127.0.0.1:6379 (Errno::ECONNREFUSED)

I think this error occurs because self.configure method call in Providers::Base#initialize. This call override configuration from initializer to default values. And HealthMonitor.check create new instance each provider on every health check.

Include extra_info to the response

I think it would be nice if additionally to environment_variables we could have a new configuration attribute to show extra information, maybe called extra_info, that would behave mostly in the same way as the current environment_variables with a few extra considerations:

  • As the name suggests, we could add anything we want to be returned, regardless of them being ENVs or not. I know we can already add any value to a key under environment_variables, but it is forcing things a bit.
  • The new config would expect a hash in the format { name: 'something', values: { key_pairs } }. Here, the name will be used to decide on the key/title to be used when building the response/page.
  • We would need to slightly modify the controller and view to take into account the new configuration attribute.

I could do a PR if this makes any sense.

Feature idea / File system permissions

We have a pretty complex set of rails apps & workers that run on top of a kubernetes cluster

We need to know if certain file system folders are writable/readable from the rails app, so nginx containers, rails & Sidekiq can read/write files to those locations.

Read/Write monitor is something that you believe makes sense to add to the health-monitor-rails core or should be dealt with as a custom monitor?

I am glad to work on this, just don't want to add this and get a rejected PR 👍

config.add_custom_provider not working.

Passing the class directly in config.add_custom_provider was not working out of the box (as mentioned in the README) and I had to pass in the instance of the provider class.

This has been fixed in the MR #105.

💡 Use own styling instead Tailwind

Would it be an idea to not include Tailwind, but add own custom styling?

This way we can prevent loading Tailwind as a dependency, but also reduce the need to set CSP headers.

An optional idea is to make this styling configurable.

provide json response with more information

Hey,

i like your gem, very neat and extendable!

Would it be interesting for you, to provide a some more information in the controller:

https://github.com/lbeder/health-monitor-rails/blob/master/app/controllers/health_monitor/health_controller.rb#L14

e.g.:

{
  "sidekiq": {
    "message": "latency 420.94790720939636 is greater than 30",
    "status": "FAILED",
    "timestamp": "2011-11-10T15:10:13+01:00"
  },
  "dalli": {
    "message": "",
    "status": "OK",
    "timestamp": "2011-11-10T15:10:13+01:00"
  }
}

Check only primary database or selected databases

We are using secondary database to sync out analytics data, and when secondary database is down, it does not affect main application. Now when support to multiple databases was added #95, then health check reports database down that triggers site down notifications for us, but in reality it does not affect any usage.

I would expect database check to have configuration options to

  • check only primary database,
  • check only databases in list, or
  • check all database expect ignored databases.

Also it would be good to have an option to set separate names for different databases, so that we can query only main database for downtime notifications. In dashboard it's good to know that secondary database is down, but we don't want to mix this with primary database check.

Feature Thoughts?

Hi, we've been evaluating the various health page engines and think that health-monitor-rails is probably the best platform to build on. We're looking at adding the following features and were curious which ones we should try and contribute back and which you'd prefer us to keep in our own fork.

Sidekiq configuration in README is misleading

When I configured the Sidekiq monitoring according to README example, then I was hitting the default limits. It seems, that Sidekiq montoring internally uses queue and following changes does NOT change the queue settings.

# Sidekiq
HealthMonitor.configure do |config|
  config.sidekiq.configure do |sidekiq_config|
    sidekiq_config.latency = 3.hours
    sidekiq_config.queue_size = 50
  end
end

It seems that the other example updates queue correctly, but the method signature is wrong, size should be queue_size

# To configure specific queues
HealthMonitor.configure do |config|
  config.sidekiq.configure do |sidekiq_config|
    sidekiq_config.add_queue_configuration("critical", latency: 10.seconds, size: 20)
  end
end

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.