Skip to content
willyaranda edited this page Oct 29, 2012 · 1 revision

How to implement a new API for a new server

  1. Add a var API = require('../common/API').API; to load the API.
  2. On your main.js::start() method, add the line API.addServers('NS_AS', this.servers);, where 'NS_AS' is the name of the main service that want you to monitor.
  3. On your server file, implement a getStats() method, that should return a JSON with the info you want to return to the API.
getStats: function() {
    return stats;
}
  1. Also, add a global object like this:
// Global stats object
var stats = {
  notifications: {
    received: 0,
    rejected: {
      badJSON: 0, // Done
      notSigned: 0,
      tooBig: 0
    },
    accepted: 0
  },
  httpRequests: {
    total: 0,
    notify: 0,
    about: 0,
    other: 0
  }
};

And update where you think it's OK.

Visit the URL where your stats should be placed, and have fun!! e.g: http://push.telefonica.es:12345/

Clone this wiki locally