lib/pkgcloud/rackspace/loadbalancer/client/loadbalancers.js
function(loadBalancer, details, callback) {
    var self = this,
        loadBalancerId =
          loadBalancer instanceof lb.LoadBalancer ? loadBalancer.id : loadBalancer;

    if (!details || !details.type) {
      throw new Error('Details is a required option for loadBalancer health monitors');
    }

    var requestOptions = {
      path: urlJoin(_urlPrefix, loadBalancerId, 'healthmonitor'),
      method: 'PUT'
    };

    if (details.type === 'CONNECT') {
      requestOptions.body = {
        attemptsBeforeDeactivation: details.attemptsBeforeDeactivation,
        type: details.type,
        delay: details.delay,
        timeout: details.timeout
      };
    }
    else if (details.type === 'HTTP' || details.type === 'HTTPS') {
      requestOptions.body = {
        attemptsBeforeDeactivation: details.attemptsBeforeDeactivation,
        type: details.type,
        delay: details.delay,
        timeout: details.timeout,
        bodyRegex: details.bodyRegex,
        path: details.path,
        statusRegex: details.statusRegex
      };

      if (details.hostHeader) {
        requestOptions.body.hostHeader = details.hostHeader;
      }
    }
    else {
      throw new Error('Unsupported health monitor type');
    }

    self._request(requestOptions, function (err) {
      return callback(err);
    });
  }
function(loadBalancer, details, callback) {
    var self = this,
        loadBalancerId =
          loadBalancer instanceof lb.LoadBalancer ? loadBalancer.id : loadBalancer;

    if (!details || !details.type) {
      throw new Error('Details is a required option for loadBalancer health monitors');
    }

    var requestOptions = {
      path: urlJoin(_urlPrefix, loadBalancerId, 'healthmonitor'),
      method: 'PUT'
    };

    if (details.type === 'CONNECT') {
      requestOptions.body = {
        attemptsBeforeDeactivation: details.attemptsBeforeDeactivation,
        type: details.type,
        delay: details.delay,
        timeout: details.timeout
      };
    }
    else if (details.type === 'HTTP' || details.type === 'HTTPS') {
      requestOptions.body = {
        attemptsBeforeDeactivation: details.attemptsBeforeDeactivation,
        type: details.type,
        delay: details.delay,
        timeout: details.timeout,
        bodyRegex: details.bodyRegex,
        path: details.path,
        statusRegex: details.statusRegex
      };

      if (details.hostHeader) {
        requestOptions.body.hostHeader = details.hostHeader;
      }
    }
    else {
      throw new Error('Unsupported health monitor type');
    }

    self._request(requestOptions, function (err) {
      return callback(err);
    });
  }
function ( loadBalancer , details , callback ) { var self = this , loadBalancerId = loadBalancer instanceof lb . LoadBalancer ? loadBalancer . id : loadBalancer ; if ( ! details || ! details . type ) { throw new Error ( 'Details is a required option for loadBalancer health monitors' ) ; } var requestOptions = { path : urlJoin ( _urlPrefix , loadBalancerId , 'healthmonitor' ) , method : 'PUT' } ; if ( details . type === 'CONNECT' ) { requestOptions . body = { attemptsBeforeDeactivation : details . attemptsBeforeDeactivation , type : details . type , delay : details . delay , timeout : details . timeout } ; } else if ( details . type === 'HTTP' || details . type === 'HTTPS' ) { requestOptions . body = { attemptsBeforeDeactivation : details . attemptsBeforeDeactivation , type : details . type , delay : details . delay , timeout : details . timeout , bodyRegex : details . bodyRegex , path : details . path , statusRegex : details . statusRegex } ; if ( details . hostHeader ) { requestOptions . body . hostHeader = details . hostHeader ; } } else { throw new Error ( 'Unsupported health monitor type' ) ; } self . _request ( requestOptions , function ( err ) { return callback ( err ) ; } ) ; }
client.updateHealthMonitor

@description get the current health monitor configuration for a loadBalancer

@param {Object}          loadBalancer      the loadBalancer or loadBalancerId
@param {Object}          details
@param {function}        callback

There are two kinds of connection monitors you can enable, CONNECT and HTTP/HTTPS.
CONNECT monitors are basically a ping check. HTTP/HTTPS checks
are used to validate a HTTP request body/status for specific information.

Sample CONNECT details:

{
type: 'CONNECT',
delay: 10,
timeout: 10,
attemptsBeforeDeactivation: 3
}

Sample HTTP details:

{
type: 'HTTP',
delay: 10,
timeout: 10,
attemptsBeforeDeactivation: 3,
path: '/',
statusRegex: '^[234][0-9][0-9]$',
bodyRegex: '^[234][0-9][0-9]$',
hostHeader: 'myrack.com'
}
client . updateHealthMonitor