function monitoring_services_sensor_result in Monitoring 7
Sensor result resource.
Parameters
string $sensor_name: Specific sensor name.
string $expand: Sensor result data to expand.
Return value
array Single sensor result data.
1 string reference to 'monitoring_services_sensor_result'
- monitoring_services_resources in ./
monitoring.module - Implements hook_services_resources().
File
- ./
monitoring.services.inc, line 56 - Monitoring remote API resource callbacks.
Code
function monitoring_services_sensor_result($sensor_name, $expand = NULL) {
try {
$result = monitoring_sensor_run($sensor_name);
$response = $result
->toArray();
$response['uri'] = services_resource_uri(array(
'sensor-result',
$sensor_name,
));
if ($expand == 'sensor_info') {
$response['sensor_info'] = $result
->getSensorInfo()
->toArray();
}
return $response;
} catch (InvalidArgumentException $e) {
return services_error($e
->getMessage(), 404);
}
}