Ping My Site

A simple CLI Pingdom-like written in ruby. Check your site's HTTP status code and notify via Slack if anything went wrong.

How to use

Git clone

git clone https://github.com/cedricbousmanne/PingMySite.git

Install required Gem

bundle

dotenv (.env)

Copy the .env_schemafile to .envand fill it.

cp .env_schema .env

Run

bin/ping-my-site ping http://google.com --expected-status-code 200 --follow-location false

Options

  • --expected-status-code XXX : define the expected HTTP status code (default: 200)
  • --follow-location true: allow CURL to follow HTTP redirection (default: false)

Usecase

Test HTTP status

bin/ping-my-site ping http://google.com --expected-status-code 200

Test HTTP redirection

bin/ping-my-site ping http://mysite.be --expected-status-code 301 --follow-location false --expected-redirect-url http://www.mysite.be

Troubleshooting

Dotenv::Schema::ValidationError

Something is missing in your .envfile. Compare it to .env_schemaand be sure every constant is defined.

Use with crontab

  • * * * * /bin/bash -l -c 'cd /path/to/ping-my-site/ && bundle exec bin/ping-my-site ping http://www.6x7asbl.be --expected-status-code 200 --follow-location false'

Technologies

Roadmap

  • Add proxy support (host, port, username, password)
  • Add content-check support (both string and regex)
  • Add description to gemspec
  • Add GitHub URL to gemspec
  • Add LICENCE file
  • Add post_install_message to gemspec

Foot Note

Coded with ♥, Ruby and Vim. Made in Belgium.