Skip to content

Commit

Permalink
adding docs
Browse files Browse the repository at this point in the history
  • Loading branch information
jeffsu committed Sep 11, 2012
1 parent 00a08a3 commit fd9f899
Show file tree
Hide file tree
Showing 4 changed files with 67 additions and 16 deletions.
51 changes: 50 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
@@ -1 +1,50 @@
# Upbeat is a high performance healthcheck/dashboard based in node
# Upbeat

Upbeat is a high performance node-based healthcheck/dashboard. Upbeat allows you to run health checks and provides a dashboard to chart the performance. It also allows you to proxy and cache these health checks so they don't tax your system. You can now reduces the number of health checks to a service from O(N) to O(1).

## Installation

As executable
```bash
npm install -g upbeat
```

Run upbeat
```bash
upbeat config.yml
```

As library
```bash
npm install upbeat
```

```js
var upbeat = require('upbeat');
var server = new upbeat.Server(configObject);
server.run();
```

## Configuration

Quickstart config:

```yaml
dashboard:
port: 2468

sync:
redis:
port: 6379
host: localhost

services:
google:
www:
strategy: http
url: https://www.google.com
connection:
strategy: tcp
host: google.com
port: 80
```
18 changes: 7 additions & 11 deletions lib/server.ms
Original file line number Diff line number Diff line change
Expand Up @@ -26,20 +26,16 @@ export class Server {
}

function sync(redis, time) {
if (this.syncConfig.sensors) {
for (var serviceName in this.services) {
var service = this.services[serviceName];
for (var sensorName in service.sensors) {
var sensor = service.sensors[sensorName];
sensor.sync(time, redis, "upbeat:services:" + serviceName + ":" + sensorName);
}
for (var serviceName in this.services) {
var service = this.services[serviceName];
for (var sensorName in service.sensors) {
var sensor = service.sensors[sensorName];
sensor.sync(time, redis, "upbeat:services:" + serviceName + ":" + sensorName);
}
}

if (this.syncConfig.stats) {
for (var k in this.stats) {
this.stats[k].syncTime(time, redis, k);
}
for (var k in this.stats) {
this.stats[k].syncTime(time, redis, k);
}
}

Expand Down
2 changes: 1 addition & 1 deletion lib/strategies/http.ms
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ module.exports = #(options) {
var data = "";

res.on('data', #(chunk) { data += chunk.toString(); });
res.on('end', #{ cb(code != 200, data) });
res.on('end', #{ cb(parseInt(code) >= 400, data) });
res.on('close', #(err) { cb(err) });
});

Expand Down
12 changes: 9 additions & 3 deletions mock/example.yml
Original file line number Diff line number Diff line change
@@ -1,4 +1,12 @@
services:
google:
www:
strategy: http
url: https://www.google.com
connection:
strategy: tcp
host: google.com
port: 80
fast-www:
good:
strategy: http
Expand Down Expand Up @@ -38,7 +46,7 @@ services:
slow: 350
fast: 250

#log: [ 'change', 'fail', 'pass', 'up', 'down' ]
log: [ 'change', 'fail', 'pass', 'up', 'down' ]

dashboard:
port: 3000
Expand All @@ -57,8 +65,6 @@ sync:
day: 60000
week: 60000

stats: true
sensors: true
redis:
port: 6379
host: localhost

0 comments on commit fd9f899

Please sign in to comment.