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).
As executable
npm install -g upbeatRun upbeat
upbeat config.ymlAs library
npm install upbeatvarupbeat=require('upbeat');varserver=newupbeat.Server(configObject);server.run();Quickstart config:
dashboard:
port: 2468sync:
redis: port: 6379host: localhostservices:
google:
www:
strategy: httpurl: http://www.google.comconnection:
strategy: tcphost: google.comport: 80Services are a way of grouping several sensor checks together. In the example above, we have a "google" service w hich we check by making a get request to "http://www.google.com" and also seeing if we have a connection to port 8 0 on the "google.com" host. In the yaml config, a service is a "hash" of sensors where the keys are the names of the sensors and the values are the configuration.
Sensors are a way of describing a health check. Each sensor config MUST at least have a strategy. Common configuration options accross all strategies are:
- timeout: number (milliseconds) to define how long it will allow a check before declaring it a failure
- interval: number (milliseconds) of time to wait between health checks (called after the result of a check)
- fall: number of fails to be considered down
- rise: number of passes to be considered up
Here are some examples of how you can use sensors and their strategies:
tcp
strategy: tcphost: google.comport: 80http
strategy: httpurl: http://www.google.compidfile
strategy: pidfilepidfile: /var/pids/mysql.pidredis
strategy: redishost: localhost # defaults to localhostport: 6379# defaults to 6379command: [ 'exists', 'foo' ]mysql
strategy: mysqlhost: host # requireduser: user # requiredpassword: pass # requiredsql: "SELECT * FROM users LIMIT 1"# defaults to "SHOW TABLES"