You are here

nagios_hook_test_module.module in Nagios Monitoring 8

File

tests/modules/nagios_hook_test_module/nagios_hook_test_module.module
View source
<?php

use Drupal\Core\Url;

/**
 * Implements hook_nagios_info().
 *
 * For more details please read the section 'API' section within README.txt.
 */
function nagios_hook_test_module_nagios_info() {
  return [
    'name' => 'nagios_hook_test_module',
    'id' => 'NAGIOS_CHECK_KEY',
  ];
}

/**
 * Implements hook_nagios().
 */
function nagios_hook_test_module_nagios() {
  return [
    'NAGIOS_CHECK_KEY' => [
      'status' => 1,
      // NAGIOS_STATUS_WARNING
      'type' => 'state',
      'text' => 'Text description for the problem',
    ],
  ];
}

/**
 * Implements hook_requirements().
 */
function nagios_hook_test_module_requirements() {
  $url = Url::fromRoute('nagios.ignored_modules');
  $url
    ->setAbsolute();
  return [
    'big_example_problem' => [
      'title' => 'Nagios Hook Test Module',
      'value' => 'This is an example error.',
      'severity' => REQUIREMENT_ERROR,
      'description' => 'This hook exists to play with IgnoredModulesForm at ' . $url
        ->toString(),
    ],
  ];
}