Health Monitors — php-opencloud 1.12.1 documentation

# Health Monitors

## Setup

In order to interact with this feature you must first retrieve a particular load balancer, like so:

    $loadBalancer = $service->loadBalancer('{id}');

## Retrieve monitor details

    /** @var $healthMonitor OpenCloud\LoadBalancer\Resource\HealthMonitor **/

    $healthMonitor = $loadBalancer->healthMonitor();

    printf(
        "Monitoring type: %s, delay: %s, timeout: %s, attempts before deactivation: %s",
        $healthMonitor->type, $healthMonitor->delay, $healthMonitor->timeout
    );

For a full list, with explanations, of required and optional attributes, please consult the official documentation

## Update monitor

    $healthMonitor->update(array(
        'delay'   => 120,
        'timeout' => 60,
        'type'    => 'CONNECT'
        'attemptsBeforeDeactivation' => 3
    ));

## Delete monitor

    $healthMonitor->delete();