dist/monitor-all.js
function(name, params, callback) {
      var t = this,
          controlFn = t[name + '_control'],
          startTime = Date.now(),
          errMsg,
          logId = 'onControl.' + t.probeClass + '.' + name;

      params = params || {};
      callback = callback || function(){};
      log.info(logId, t.get('id'), params);

      if (!controlFn) {
        errMsg = 'No control function: ' + name;
        log.error(logId, errMsg);
        return callback({msg: errMsg});
      }

      var whenDone = function(error) {
        if (error) {
          log.error(logId + '.whenDone', error);
          return callback(error);
        }
        var duration = Date.now() - startTime;
        log.info(logId, params);
        stat.time(t.logId, duration);
        callback.apply(null, arguments);
      };

      // Run the control on next tick.  This provides a consistent callback
      // chain for local and remote probes.
      setTimeout(function(){
        try {
          controlFn.call(t, params, whenDone);
        } catch (e) {
          errMsg = 'Error calling control: ' + t.probeClass + ':' + name;
          whenDone({msg:errMsg, err: e.toString()});
        }
      }, 0);
    }
function(name, params, callback) {
      var t = this,
          controlFn = t[name + '_control'],
          startTime = Date.now(),
          errMsg,
          logId = 'onControl.' + t.probeClass + '.' + name;

      params = params || {};
      callback = callback || function(){};
      log.info(logId, t.get('id'), params);

      if (!controlFn) {
        errMsg = 'No control function: ' + name;
        log.error(logId, errMsg);
        return callback({msg: errMsg});
      }

      var whenDone = function(error) {
        if (error) {
          log.error(logId + '.whenDone', error);
          return callback(error);
        }
        var duration = Date.now() - startTime;
        log.info(logId, params);
        stat.time(t.logId, duration);
        callback.apply(null, arguments);
      };

      // Run the control on next tick.  This provides a consistent callback
      // chain for local and remote probes.
      setTimeout(function(){
        try {
          controlFn.call(t, params, whenDone);
        } catch (e) {
          errMsg = 'Error calling control: ' + t.probeClass + ':' + name;
          whenDone({msg:errMsg, err: e.toString()});
        }
      }, 0);
    }
function ( name , params , callback ) { var t = this , controlFn = t [ name + '_control' ] , startTime = Date . now ( ) , errMsg , logId = 'onControl.' + t . probeClass + '.' + name ; params = params || { } ; callback = callback || function ( ) { } ; log . info ( logId , t . get ( 'id' ) , params ) ; if ( ! controlFn ) { errMsg = 'No control function: ' + name ; log . error ( logId , errMsg ) ; return callback ( { msg : errMsg } ) ; } var whenDone = function ( error ) { if ( error ) { log . error ( logId + '.whenDone' , error ) ; return callback ( error ) ; } var duration = Date . now ( ) - startTime ; log . info ( logId , params ) ; stat . time ( t . logId , duration ) ; callback . apply ( null , arguments ) ; } ; // Run the control on next tick.  This provides a consistent callback // chain for local and remote probes. setTimeout ( function ( ) { try { controlFn . call ( t , params , whenDone ) ; } catch ( e ) { errMsg = 'Error calling control: ' + t . probeClass + ':' + name ; whenDone ( { msg : errMsg , err : e . toString ( ) } ) ; } } , 0 ) ; }
Dispatch a control message to the appropriate control function.

This is called when the
<a href="Monitor.html#method_control">```control()```</a>
method of a monitor is called.
The name determines the method name called on the probe.

The probe must implement a method with the name ```{name}_control()```,
and that method must accept two parameters - an input params and a callback.
The callback must be called, passing an optional error and response object.

For example, if the probe supports a control with the name ```go```, then
all it needs to do is implement the ```go_control()``` method with the
proper signature.  See ```ping_control()``` for an example.

@method onControl
@param name {String} Name of the control message.
@param [params] {Any} Input parameters specific to the control message.
@param [callback] {Function(error, response)} Called to send the message (or error) response.
<ul>
<li>error (Any) An object describing an error (null if no errors)</li>
<li>response (Any) Response parameters specific to the control message.
</ul>
Dispatch a control message to the appropriate control function .