You are here

function monitoring_services_sensors_results in Monitoring 7

Sensor result resource.

Parameters

string $expand: Sensor result data to expand.

Return value

array List of all sensors results data.

1 string reference to 'monitoring_services_sensors_results'
monitoring_services_resources in ./monitoring.module
Implements hook_services_resources().

File

./monitoring.services.inc, line 81
Monitoring remote API resource callbacks.

Code

function monitoring_services_sensors_results($expand = NULL) {
  $response = array();
  foreach (monitoring_sensor_run_multiple() as $sensor_name => $sensor_result) {
    $response[$sensor_name] = $sensor_result
      ->toArray();
    $response[$sensor_name]['uri'] = services_resource_uri(array(
      'sensor-result',
      $sensor_name,
    ));
    if ($expand == 'sensor_info') {
      $response[$sensor_name]['sensor_info'] = $sensor_result
        ->getSensorInfo()
        ->toArray();
    }
  }
  return $response;
}