chris-gooley / monitor_page

A gem to view status checks of multiple services from a single page.

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

MonitorPage

A gem to view status checks of multiple services from a single page.

Usage

Create an initializer and setup your checks. Each check should have a pass and an error call.

MonitorPage.configure do
  # Whitelist IPs that have access to the status page. Can be a single IP or of CIDR notation.
  # Optional: if left out it will be publically available
  permit '1.1.1.1', '1.1.2.0/24'

  check 'Sidekiq' do
    if Sidekiq::Queue.all.select{ |q| q.size > 50 }.any?
      error "Sidekiq has too many jobs"
    else
      pass
    end
  end

  check 'Passing Check' do
    pass
  end

  check 'Failing Check' do
    error "GAME OVER MAN, GAME OVER!"
  end
end

In your routes:

  mount MonitorPage::Engine, at: '/monitor_page'

Visiting /monitor_page should give you something like this:

Sidekiq: Passed
Passing Check: Passed
Failing Check: Failed - GAME OVER MAN, GAME OVER!
-----------
Overall: Failed

Overall will always display Passed or Failed based on if all the above checks have passed or if there is a failure.

Installation

Add this line to your application's Gemfile:

gem 'monitor_page'

And then execute:

$ bundle

Or install it yourself as:

$ gem install monitor_page

License

The gem is available as open source under the terms of the MIT License.

About

A gem to view status checks of multiple services from a single page.

License:MIT License


Languages

Language:Ruby 75.9%Language:HTML 17.7%Language:JavaScript 4.1%Language:CSS 2.3%