You are here

function drush_nagios_check in Nagios Monitoring 6

Same name and namespace in other branches
  1. 8 nagios.drush.inc \drush_nagios_check()
  2. 7 nagios.drush.inc \drush_nagios_check()

Drush command callback: nagios-check.

File

./nagios.drush.inc, line 40

Code

function drush_nagios_check($check = null) {
  if (isset($check)) {
    foreach (module_implements('nagios_checks') as $module) {
      if (in_array($check, array_keys(module_invoke($module, 'nagios_checks')))) {
        return nagios_check($module, $check);
      }
    }
    foreach (drush_command_implements('nagios_checks') as $command) {
      $function = $command . '_nagios_checks';
      if (in_array($check, array_keys($function()))) {
        return nagios_check($command, $check);
      }
    }
    drush_set_error(dt('The requested nagios check does not exist: !check.', array(
      '!check' => $check,
    )));
  }
  else {
    drush_set_error(dt('Missing argument for nagios-check'));
  }
}