function monitoring_drush_info_single in Monitoring 7
Prints detailed info about the given sensor $sensor_name.
Parameters
string $sensor_name: Sensor name for which to print info.
1 call to monitoring_drush_info_single()
- monitoring_drush_info in ./
monitoring.drush.inc - Drush callback to get available sensors info.
File
- ./
monitoring.drush.inc, line 170 - Drush support for monitoring.
Code
function monitoring_drush_info_single($sensor_name) {
$sensor_info = NULL;
try {
$sensor_info = monitoring_sensor_manager()
->getSensorInfoByName($sensor_name);
} catch (NonExistingSensorException $e) {
return drush_set_error('MONITORING_SENSOR_INVALID_NAME', dt('Sensor "@name" does not exist.', array(
'@name' => $sensor_name,
)));
}
$rows[] = array(
format_string("@label (@name)", array(
'@label' => $sensor_info
->getLabel(),
'@name' => $sensor_info
->getName(),
)),
'====================',
);
$rows[] = array(
dt('Category'),
$sensor_info
->getCategory(),
);
$rows[] = array(
dt('Description'),
$sensor_info
->getDescription(),
);
$rows[] = array(
dt('Value info'),
format_string('type: @type, label: @label, numeric: @numeric', array(
'@type' => $sensor_info
->getValueType() ? $sensor_info
->getValueType() : dt('N/A'),
'@label' => $sensor_info
->getValueLabel() ? $sensor_info
->getValueLabel() : dt('N/A'),
'@numeric' => $sensor_info
->isNumeric() ? dt('Yes') : dt('No'),
)),
);
$rows[] = array(
dt('Caching time'),
format_interval($sensor_info
->getCachingTime()),
);
$rows[] = array(
dt('Enabled'),
$sensor_info
->isEnabled() ? dt('Yes') : dt('No'),
);
$rows[] = array(
dt('Has thresholds'),
$sensor_info
->isDefiningThresholds() ? dt('Yes') : dt('No'),
);
$rows[] = array(
dt('Is configurable'),
$sensor_info
->isConfigurable() ? dt('Yes') : dt('No'),
);
drush_print_table($rows);
}