heilo v1.0.4
heilo, is your server up or down?
heilo there
If you are looking for a NodeJS-based server status monitoring tool, heilo is for you. It is lightweight, simple to use, and has clean interface. It can be used programmatically as an npm module, or cli tool.
Default behaviour will ping a host every 10 minutes (configurable) to check if it is UP, UP with Error or DOWN.
NOTE: heilo does not come with any notification/reporting functionality. Though heilo provides an interface for you to write your own notification/reporting function. Here is an example on how you can write a simple email notification system using nodemailer and deploy to Now - heilo-mail.
Usage
NOTE: heilo requires Node 6.0.0 and above
Use Programmatically as Module
Install it as dependencies
npm install heilo --saveUse it
const heilo = require('heilo')
heilo('https://localhost', {
interval: '10m', // ping interval
stopLooping = false, // stop pinging, useful if you want to control the start/stop manually
report = (error) => {}, // function to report any error (e.g. send email when server down)
debug = false, // log every ping result to STDOUT if set to true,
fetchOptions = { method: 'GET' } // options passed to fetch(url, fetchOptions)
})Refer to this example for more details on how to write the report function.
Use as CLI
Install it globally
npm install -g heiloRun it
heilo <absolute_url_path> [options]Here are some examples of its usage:
heilo http://localhost
heilo http://localhost -i 5m
heilo http://localhost -f ./examples/reporting.jsOptions
| Usage | Description | Default value |
|---|---|---|
| -h, --help | Output usage information | - |
| -d, --debug | Debug Mode (log to STDOUT) | false |
| -p, --port port | Specific port to ping | - |
| -i, --interval interval | String value of the ping interval (refer to ms module for available values) | '10m' |
| -f, --file FILE | .js file that exports a function to report any error (e.g. send email when server down) | - |
Contribute
- Fork this repository to your own GitHub account and then clone it to your local device
- Uninstall
heiloif it's already installed:npm uninstall -g heilo - Link it to the global module directory (to use
heilocommand everywhere):npm link - Once you make some changes, transpile the source code:
npm run build - Use
heilocommand to test anyclichanges - Test the Programmatic API:
npm run example
Credit
Thanks to projects like micro and serve that gives me inspiration and a head-start on how to write and structure this module.