GithubHelp home page GithubHelp logo

node-mongomon's Introduction

mongomon

mongomon is a MongoDB server status monitor written for node.js.

The current version is a wrapper around the several mongo diagnostic commands that are available in the mongo shell.

  • db.serverStatus()
  • db.stats()
  • db.[collectionName].stats()

This can be used to monitor the mongos shard router, or mongod instances.

mongomon.start() is used to start the interval that monitors the server statistics. The methods to get database stats and collection stats are not meant to be run very often, therefore, they do not run on the interval when mongomon.start() is called, and have to be called manually.

For example, you can run this to monitor each mongos and mongod process in your cluster every 60 seconds, but only run the database stats and collection stats once or twice a day.

Usage:

var Mongomon = require('./index');
var mongomon = new Mongomon({interval: 5000, url: 'mongodb://localhost:27017/mydatabase'});

mongomon.on('mongostat', function(data){
  console.log('server stats:',JSON.stringify(data));
  console.log();
});

mongomon.on('dbstat', function(data){
  console.log('db stats:',JSON.stringify(data));
  console.log();
});

mongomon.on('collstat', function(data){
  console.log('collection stats:',JSON.stringify(data));
  console.log();
});

//start calling db.serverStatus() on the provided interval
mongomon.start();

//or, to just get stats, you can manually connect and pull them

mongomon.connect(function(){
  //get database statistics once
  mongomon.getDBStats();
  //get collection statistics once (for each collection in the database)
  mongomon.getCollStats();
});

node-mongomon's People

Contributors

niahmiah avatar

Stargazers

 avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar

node-mongomon's Issues

Assertion failure _setName.size() src/mongo/client/d

I want to use mongo server status in node while connecting i am getting this.

This way i am trying to connect i replace actual data to test

var Mongomon = require('./index');
var mongomon = new Mongomon({interval: 2000, url: 'mongodb://test:test@test:35036/test?authSource=admin'});

And after this i am getting this error is it bug or something else?

undefined:1
Wed Mar 21 19:08:41.617   Assertion failure _setName.size() src/mongo/client/d
^
SyntaxError: Unexpected token W
    at Object.parse (native)
    at bson2json (../node_modules/mongomon/lib/bson2json.js:17:15)
    at Socket.DBstat.fetchData (../node_modules/mongomon/lib/dbstat.js:23:12)
    at Socket.emit (events.js:117:20)
    at Socket.stream.pause.paused (_stream_readable.js:764:14)
    at Socket.emit (events.js:92:17)
    at emitReadable_ (_stream_readable.js:426:10)
    at emitReadable (_stream_readable.js:422:5)
    at readableAddChunk (_stream_readable.js:165:9)
    at Socket.Readable.push (_stream_readable.js:127:10)

node -v // 6.0.0

Please help

Action required: Greenkeeper could not be activated 🚨

🚨 You need to enable Continuous Integration on all branches of this repository. 🚨

To enable Greenkeeper, you need to make sure that a commit status is reported on all branches. This is required by Greenkeeper because we are using your CI build statuses to figure out when to notify you about breaking changes.

Since we did not receive a CI status on the greenkeeper/initial branch, we assume that you still need to configure it.

If you have already set up a CI for this repository, you might need to check your configuration. Make sure it will run on all new branches. If you don’t want it to run on every branch, you can whitelist branches starting with greenkeeper/.

We recommend using Travis CI, but Greenkeeper will work with every other CI service as well.

Once you have installed CI on this repository, you’ll need to re-trigger Greenkeeper’s initial Pull Request. To do this, please delete the greenkeeper/initial branch in this repository, and then remove and re-add this repository to the Greenkeeper integration’s white list on Github. You'll find this list on your repo or organization’s settings page, under Installed GitHub Apps.

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.