public function MonitoringCommands::sensorConfig in Monitoring 8
Displays detailed information about the sensor config.
@usage drush monitoring-sensor-config node_new Prints info of the node_new sensor. @validate-module-enabled monitoring
@command monitoring:sensor-config @aliases monitoring-sensor-config @field-labels label: Label category: Category description: Description value_info: Value info caching_time: Caching time enabled: Enabled has_thresholds: Has thresholds
Parameters
string $sensor_name: Specific sensor name for which we want to display info.
Return value
\Consolidation\OutputFormatters\StructuredData\PropertyList A list with sensor config properties.
File
- src/
Commands/ MonitoringCommands.php, line 138
Class
- MonitoringCommands
- A Drush commandfile for the Monitoring module.
Namespace
Drupal\monitoring\CommandsCode
public function sensorConfig($sensor_name = NULL) {
$sensor_config = $this->sensorManager
->getSensorConfigByName($sensor_name);
$data = [
'label' => $sensor_config
->label(),
'category' => $sensor_config
->getCategory(),
'description' => $sensor_config
->getDescription(),
'value_info' => new FormattableMarkup('type: @type, label: @label, numeric: @numeric', [
'@type' => $sensor_config
->getValueType() ?: dt('N/A'),
'@label' => $sensor_config
->getValueLabel() ?: dt('N/A'),
'@numeric' => $sensor_config
->isNumeric() ? dt('Yes') : dt('No'),
]),
'caching_time' => $this->dateFormatter
->formatInterval($sensor_config
->getCachingTime()),
'enabled' => $sensor_config
->isEnabled() ? dt('Yes') : dt('No'),
'has_thresholds' => $sensor_config
->isDefiningThresholds() ? dt('Yes') : dt('No'),
];
return new PropertyList($data);
}