Coder Social home page Coder Social logo

fail_notifier's Introduction

Note: In January 2013, Notifo ceased operations, so this app does not work anymore!

Fail Notifier

Fail Notifier is a small Sinatra app that uses Notifo to alert you of any failures you want to be notified about.

Why this app, instead of pinging Notifo directly?

I manage multiple servers, all with their own services, built on top of different operating systems and using different programming languages. Instead of configuring each server with my Notifo account info and other things, it would be easier to just have one single place handle the work. All I need to do is set up this Sinatra (either on your own server, or a free service like Heroku), configure the necessary environment variables, and that's it. Every service can then use a simple HTTP request to notify you.

What do I need?

Of course, make sure you have Ruby installed (get RVM if you don't have it installed yet!). I've tested on 1.8.7, 1.9.2 and Ruby Enterprise Edition. Bundler is really all you need to set up all required gems.

gem install bundler
bundle install

For those who want to know, here's the list of gems currently required for the application to run properly:

If you're developing and want to add or modify tests (and you should!), these gems are also required:

How does it work?

Before doing anything with this app, you need to register for a Notifo account, and have Notifo installed on your mobile device or desktop. Currently, Notifo is only available on the iPhone and as Growl notifications on the Mac, but they're working on other platforms and will hopefully have them available soon.

On the server where this application will be installed, you need to set up a few environment variables that contain your Notifo account information. These can be found under 'Settings' when you log in to your Notifo account:

  • NOTIFO_USERNAME - Your Notifo username
  • NOTIFO_API_SECRET - The API secret Notifo assigns to you

There are some additional environment variables that need to be set up for Basic Authentication to work (to avoid unauthorized sources from bombarding you with notifications):

  • FAIL_NOTIFIER_USER - Basic Authentication Username
  • FAIL_NOTIFIER_PASS - Basic Authentication Password

Once the environment variables are set up and the Sinatra app is running, all you need to do is send an HTTP POST request to Fail Notifier (For example: http://my-personal-server.com/fail) with the following params:

  • message (required) - The message that will appear on your Notifo alert
  • title (optional) - The title of the Notifo alert
  • url (optional) - Notifo allows you to specify a URL to open when clicking on an alert in your list

There are a few examples for different programming languages in the Wiki.

Deploying on Heroku

Heroku is a great place to deploy Fail Notifier. It's rather easy to get up and running. Here's the short version of grabbing a copy of Fail Notifier and deploying on Heroku:

git clone git://github.com/dennmart/fail_notifier.git
cd fail_notifier
heroku create my-fail-notifier
heroku config:add NOTIFO_USERNAME=<Your Notifo Username> NOTIFO_API_SECRET=<Your Notifo API Secret> FAIL_NOTIFIER_USER=<Basic Auth User> FAIL_NOTIFIER_PASS=<Basic Auth Password>
git push heroku master

And that's it! Your instance of Fail Notifier should be up and running. You can run a quick test using cURL in the terminal:

curl http://my-fail-notifier.heroku.com/fail -X POST -u <Basic Auth User>:<Basic Auth Password> -d message="Test Message"

What next?

I'll probably add some minor changes in functionality later on, but as it is now, it's working just like I need it. Feel free to fork this and do with this app as you please. Also feel free to send me a message if there are any questions / suggestions. Happy hacking!

fail_notifier's People

Contributors

dennmart avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar

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.