You are here

function monitoring_services_sensor_info in Monitoring 7

Sensor info resource.

Parameters

string $sensor_name: Specific sensor name.

Return value

array Sensor info data as array.

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

File

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

Code

function monitoring_services_sensor_info($sensor_name) {
  try {
    $response = monitoring_sensor_manager()
      ->getSensorInfoByName($sensor_name)
      ->toArray();
    $response['uri'] = services_resource_uri(array(
      'sensor-info',
      $sensor_name,
    ));
    return $response;
  } catch (NonExistingSensorException $e) {
    services_error($e
      ->getMessage(), 404);
  }
}