Skip to content

Simple synthetic monitoring - runs rspec specs given to it every x minutes (defaults to 5 minutes but can be overridden) and alerts on a Slack channel or group of your choosing if any tests fail.

Notifications You must be signed in to change notification settings

johnboyes/synthetic-monitor

Repository files navigation

synthetic-monitor CircleCI

Simple website synthetic monitoring gem.

Example app which uses this gem: example-synthetic-monitor

The example application is deployable on Heroku which makes it very quick to get production monitoring up and running, and the monitoring is specified in plain old RSpec tests, which means that your monitoring is much more easily customised to your needs than most solutions.

Run all the specs in the 'spec' directory, every 5 minutes, and notify any failures on a Slack channel or group (with SMS notifications coming soon):

SyntheticMonitor.new.monitor ENV['SLACK_WEBHOOK_URL']

(jump to this code snippet)

Alternatively you can have individual spec files notify an individual Slack channel or group:

spec_slack_pairs = {
  'spec/a_spec.rb' => ENV['A_SlACK_WEBHOOK_URL'],
  'spec/another_spec.rb' => ENV['A_DIFFERENT_SLACK_WEBHOOK_URL'],
  'spec/a_third_spec.rb' => ENV['A_THIRD_SLACK_WEBHOOK_URL'],
}

SyntheticMonitor.new.monitor_on_varying_slack_channels spec_slack_pairs

The monitoring frequency is customisable:

SyntheticMonitor.new(frequency_in_minutes: 10).monitor

An example spec:

scenario "monitor example.com" do
  @session.visit 'https://www.example.com'
  expect(@session).to have_content("This domain is established to be used for illustrative examples in documents.")
  expect(@session.status_code).to eq(200)
end

(jump to this code snippet)

Running the functional tests

bundle exec rake test

Coming soon

About

Simple synthetic monitoring - runs rspec specs given to it every x minutes (defaults to 5 minutes but can be overridden) and alerts on a Slack channel or group of your choosing if any tests fail.

Topics

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages