GithubHelp home page GithubHelp logo

isabella232 / micro-monitor Goto Github PK

View Code? Open in Web Editor NEW

This project forked from npm/micro-monitor

0.0 0.0 0.0 67 KB

add a monitoring endpoint to your node background services

License: ISC License

JavaScript 100.00%

micro-monitor's Introduction

Micro Monitor

Build Status Coverage Status

Add a standardized monitoring endpoint to your application. Especially useful for adding monitoring to services that do not expose an HTTP interface.

Basic Usage

Simply initialize the monitor when your application starts up:

const Monitor = require('micro-monitor')

let monitor = Monitor(9999, () => {
// do something now that monitoring is running
})
  • http://0.0.0.1:9999/_monitor/status is now available, and will respond with a 200 status and status object:
{
  "pid": 42176,
  "uptime": 0.796,
  "rss": {
    "rss": 53907456,
    "heapTotal": 37728256,
    "heapUsed": 26032248
  },
  "cmdline": [
    "/Users/benjamincoe/.nvm/versions/node/v7.1.0/bin/node",
    "/Users/benjamincoe/npm-inc/micro-monitor/node_modules/mocha/bin/_mocha",
    "test.js"
  ],
  "git": "b0c57aa"
}
  • http://0.0.0.1:9999/_monitor/ping is also available and will respond with status 200 and the text pong.

Customizing Status Information

You can customize the status information returned using contribute:

  • monitor.contribute(contributor): contribute additional information to the status object returned on /_monitor/status.
    • contributor: a function returning the object to supplement the status object with.

Configuration

When the monitor is first started, it will attempt to pull the commit hash for the current project by performing a git rev-parse. If you wish to supply your own value for the git field, set the BUILD_HASH environment variable.

Shutdown

You can halt the monitor using stop:

  • monitor.stop() โ‡’ Promise: halt the monitor
    • close: a function returning a Promise which is resolved once the monitor server has halted.

License

ISC

micro-monitor's People

Contributors

bcoe avatar ceejbot avatar chrisdickinson avatar joeledwards avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.