You are here

function nagios_invoke_all in Nagios Monitoring 8

Same name and namespace in other branches
  1. 5 nagios.module \nagios_invoke_all()
  2. 6 nagios.module \nagios_invoke_all()
  3. 7 nagios.module \nagios_invoke_all()

Custom invoke function checking our config for which modules to include.

Parameters

string $hook:

Return value

array keyed by module name

5 calls to nagios_invoke_all()
CustomHookCheckTest::testHooksInAnotherModule in tests/src/Kernel/CustomHookCheckTest.php
NagiosCommands::nagios in src/Commands/NagiosCommands.php
Allows querying Drupal's health. Useful for NRPE.
SettingsForm::buildForm in src/Form/SettingsForm.php
Form constructor.
SettingsForm::submitForm in src/Form/SettingsForm.php
Form submission handler.
StatuspageController::content in src/Controller/StatuspageController.php
Main function building the string to show via HTTP.

File

./nagios.module, line 95
Main file for Nagios service monitoring.

Code

function nagios_invoke_all($hook = 'nagios') {
  $return = [];
  $args = func_get_args();
  $moduleHandler = Drupal::moduleHandler();
  $config = Drupal::config('nagios.settings');
  foreach ($moduleHandler
    ->getImplementations($hook) as $module) {

    // If we're running the checks, see if the checks for that module
    // are enabled, otherwise just continue:
    if ($hook == 'nagios' && !SettingsForm::getModuleHookEnabled($module, $config)) {
      continue;
    }
    $result = $moduleHandler
      ->invoke($module, $hook, $args);
    $return[$module] = $result;
  }
  return $return;
}