diff --git a/README.md b/README.md
index 046fd06c..e3f4dbe1 100644
--- a/README.md
+++ b/README.md
@@ -1,18 +1,16 @@
# "watchmen", a service monitor for node.js
-- monitor service health in your servers (http, smtp, etc).
-- **storages are plugable**. At this time, only redis storage is available.
-- **ping types are plugable**. At this time, http (with https) and stmp (tcp connection check) are available.
+- monitor service health (outages, uptime, response time warnings, avg. response time, etc) in your servers (`http`, `smtp`, etc).
+- use the database of your choice. Data **storages are pluggable**. At this time, only [redis](http://redis.io) storage is available, but it is pretty easy to create and plug your own. There are plans to support `couchdb` and `mongodb` in the short term.
+- **ping types are pluggable**. At this time, `http` (includes `https`) and `smtp` (tcp connection check) are available.
- watchmen provides **customizable notifications** if service is down, the response time is over a predefined limit, etc..
-- a lot of effort has been made in keeping the code base small, simple and easy to understand and modify.
-
-Using http ping service, for instance, you can check for a) certain status code or b) a certain text in the response stream.
+- the code base aims to be small, simple and easy to understand and modify.
There is a related blog post about watchmen here.
# Demo
-You can see an online demo of how watchmen control panel looks here.
+Check the **web interface** in action here.
![List of hosts](https://github.com/iloire/WatchMen/raw/1.x/screenshots/list_hosts_v010.png)
@@ -35,6 +33,8 @@ Make sure you install those dependencies:
You need at least one service for each host. Define the ping service type for each host or service.
+Most of the properties can be defined either at host or service level. Service level properties will be prioritized.
+
```js
//-------------------
//config/hosts.js
@@ -81,17 +81,39 @@ You need at least one service for each host. Define the ping service type for ea
warning_if_takes_more_than: 700, //miliseconds. alert if request takes more than this
services : [
{
- name : 'home'
+ name : 'my smtp server'
}
]
}
```
+### Ping services
+
+#### HTTP
+
+Using http ping service, you can also check for a) certain http status code or b) a certain text in the response stream.
+
+##### Main properties:
+
+- `host.host`
+- `host.port`
+- `host.ping_service_name` (use 'http', although it is the default value)
+- `service.method` (get/post)
+- `service.url`
+- `service.expected` (expected status code, expected text to be found in response)
+
+#### SMTP
+##### Main properties:
+
+- `host.host`
+- `host.port`
+- `host.ping_service_name` (use 'smtp')
+
### b) Define Postmark and notifications settings:
```js
//-------------------
-//config/general.js
+// config/general.js
//-------------------
module.exports.notifications = {
@@ -108,7 +130,7 @@ module.exports.notifications = {
```js
//-------------------
-//config/storage.js
+// config/storage.js
//-------------------
module.exports = {
@@ -131,6 +153,47 @@ module.exports = {
}
}
};
+```
+### Storage providers
+
+#### Redis
+##### Installation and configuration
+
+1. get redis from [redis.io](http://redis.io)
+2. launch the server:
+
+```
+ $ redis-server redis.conf
+```
+### d) Add custom logic
+
+Example: log in the console and send email if there is an outage:
+
+```js
+//-------------------
+// server.js
+//-------------------
+
+watchmen.on('service_error', function(service, state){
+
+ /*
+ //Do here any additional stuff when you get an error
+ */
+ var info = service.url_info + ' down!. Error: ' + state.error + '. Retrying in ' +
+ (parseInt(state.next_attempt_secs, 10) / 60) + ' minute(s)..';
+
+ console.log (info);
+
+
+ if (state.prev_state.status === 'success' && config.notifications.enabled){
+ email_service.sendEmail(
+ service.alert_to,
+ service.url_info + ' is down!',
+ service.url_info + ' is down!. Reason: ' + error
+ );
+ }
+});
+
```
## Run watchmen
@@ -143,7 +206,7 @@ or more probably you would want to use **forever** to run it in the background
$ forever start watchmen.js
-### Run the web app to display status reports**
+### Run the web app
$ forever start webserver/app.js 3000 #(where 3000 is the port you want to use).
@@ -158,16 +221,15 @@ Run the tests with mocha:
**1.0.alpha1 Major changes and improvements**
-- Storages are now plugable. Redis storage is used by default but you can create your own : couchdb, mongodb, text file, etc (see lib/storage).
-- Ping services are now plugable. For now we have http and smtp (smtp is just checking tcp connection right now). You can create your own or improve the existent ones easily.
-- Watchmen daemon now inherits from events.EventEmitter, so you can instanciate it and subscribe to the events of your choice (service_error, service_back, etc) to implement your custom logic (see server.js).
-- Knockout.js has been removed. It uses handlebars instead. Faster, simpler code, avoid some client side memory leacks.
-- Client side is using moment.js for rendering dates.
-- Express routes now are handled on /routes
-- Mocha is used for unit testing. Mocked storages and ping services are used.
-- More features, less code. :-)
-- Configuration is now in separate files, under /config directory
-- Better reporting UI. **Uptime statistics**. Outages count, warnings count.
+- **Storages** are now pluggable. `redis` storage is used by default but you can create your own : `couchdb`, `mongodb`, text file, etc (see lib/storage).
+- **Ping services** are also pluggable now. So far you can use `http` and `smtp` (`smtp` is just checking tcp connection right now). You can create your own or improve the existent ones easily.
+- Watchmen daemon now inherits from `events.EventEmitter`, so you can instanciate it and subscribe to the events of your choice (service_error, service_back, etc) to implement your custom logic (see server.js).
+- [Knockout.js](http://knockoutjs.com) has been removed. Watchmen uses handlebars now instead. Faster, simpler code, and avoids some client side memory leacks.
+- Client side is using [moment.js](http://momentjs.com) for rendering dates.
+- [Express.js](http://expressjs.com) routes now are handled on /routes
+- [Mocha](visionmedia.github.com/mocha/ ) is used for unit testing. Mocked storages and ping services are used.
+- Configuration is now spread in separate files, under the /config directory
+- Better reporting web interface. **Uptime statistics**. Outages count, warnings count.
**0.9**
@@ -237,6 +299,7 @@ Run the tests with mocha:
## TODO
+- Event pagination in service details
- Twitter integration (pipe events to a twitter account)
- Security (authentication for accesing the web UI and or editing stuff)
- Google charts