Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
A simple node.js service monitor
JavaScript HTML CSS

Fetching latest commit…

Cannot retrieve the latest commit at this time

Failed to load latest commit information.
README.md
config.js
postmark.js
watchmen.js

README.md

"watchmen", HTTP monitor for node.js

  • "watchmen" monitors HTTP servers by sending GET or POST pings (HTTP requests) in pre-defined intervals.
  • You can check for a) certain status code or b) a certain text in the response stream.
  • If site is down, ping interval will change (10', 30', 1 hour, etc... set in config file) until the site is back up again. Once the service is up again you get another email.
  • You are notified by email if the site is down by using postmarkapp.com (you can choose whatever being notified in the first, second, etc.. failure). You will be notified once the site is back up online.

Configuration

Edit config.js:

a) Define hosts and url's to be monitored:

    {
        name:'letsnode.com',
        host: 'letsnode.com',
        port:80, 
        ping_interval: one_minute * 5, //set ping interval (in seconds)
        //set retry interval (in minutes), you can add as many intervals as you want
        //if site is still down, will repeat the last interval
        retry_in: [10,30,120], 
        enabled: true, //enables/disables this host
        notify_after_failed_ping: 1, //want to receive notification after "n" failed pings
        urls : [
            {
                method: 'get', 
                url : '/', 
                //expected status code and expected string to be found in the response (otherwise will fail)
                expected: {statuscode: 200, contains: 'A blog about node.js and express.js'}
            }
        ]
    }

b) Define Postmark and notifications settings:

    exports.notifications = {
        Enabled: true, //if disabled, just console messages on site down
        To: 'ivan@iloire.com'
    } 

    exports.postmark = {
        From: 'your-email-here',
        Api_key : 'your-postmark-key-here'
    }

c) Run watchmen

    $ node watchmen.js

or probably you would want to use forever to run it in the background (more commmon)

    $ forever start watchmen.js

History

0.2

  • Allow POST method (for testing forms)
  • Added Marak/colors.js to output success and error messages
  • Displays request duration time
  • Refactoring

0.1

  • First release.

TODO

  • Create NPM package
  • Write log to file
  • Stats
  • Regular expressions support
  • REDIS support
  • Warning if request takes more than xx miliseconds
Something went wrong with that request. Please try again.