public function NagiosCommands::nagios_list in Nagios Monitoring 8
Prints valid checks for `drush nagios`.
@command nagios-list @table-style default @field-labels check: Check description: Description module: Module @default-fields check,description @filter-output
Return value
\Consolidation\OutputFormatters\StructuredData\RowsOfFields
File
- src/
Commands/ NagiosCommands.php, line 83
Class
- NagiosCommands
- Drush command file for Nagios
Namespace
Drupal\nagios\CommandsCode
public function nagios_list() {
$valid_checks = nagios_functions();
$rows = [];
foreach ($valid_checks as $check => $description) {
$rows[$check] = [
'check' => $check,
'description' => $description,
'module' => 'nagios',
];
}
$moduleHandler = \Drupal::moduleHandler();
$module_names = $moduleHandler
->getImplementations('nagios');
foreach ($module_names as $name) {
$info = $moduleHandler
->invoke($name, 'nagios_info');
$description = !empty($info['name']) && is_string($info['name']) ? $info['name'] : '';
$rows[$name] = [
'check' => $name,
'description' => $description,
'module' => $name,
];
}
ksort($rows);
return new RowsOfFields($rows);
}