You are here

public static function StatuspageController::setNagiosStatusConstants in Nagios Monitoring 8

For backwards compatibility, this module uses defines to set levels.

This function is called globally in nagios.module.

Parameters

\Drupal\Core\Config\ImmutableConfig|null $config: Config to read the values from

5 calls to StatuspageController::setNagiosStatusConstants()
CustomHookCheckTest::setUp in tests/src/Kernel/CustomHookCheckTest.php
Perform any initial set up tasks that run before every test method
MaintenanceModeTest::setUp in tests/src/Kernel/MaintenanceModeTest.php
Perform any initial set up tasks that run before every test method.
nagios.module in ./nagios.module
Main file for Nagios service monitoring.
NagiosCheckTest::setUp in tests/src/Kernel/NagiosCheckTest.php
Perform any initial set up tasks that run before every test method.
WatchdogCheckTest::setUp in tests/src/Kernel/WatchdogCheckTest.php
Perform any initial set up tasks that run before every test method.

File

src/Controller/StatuspageController.php, line 180

Class

StatuspageController
Class StatuspageController produces the HTTP output that the bash script in the nagios-plugin directory understands.

Namespace

Drupal\nagios\Controller

Code

public static function setNagiosStatusConstants(ImmutableConfig $config = NULL) {

  // Defines to be used by this module and others that use its hook_nagios().
  if (!$config) {
    $config = \Drupal::config('nagios.settings');
  }
  if ($config
    ->get('nagios.status.ok') === NULL) {

    // Should only happen in tests, as the config might not be loaded yet.
    return;
  }
  define('NAGIOS_STATUS_OK', $config
    ->get('nagios.status.ok'));
  define('NAGIOS_STATUS_WARNING', $config
    ->get('nagios.status.warning'));
  define('NAGIOS_STATUS_CRITICAL', $config
    ->get('nagios.status.critical'));
  define('NAGIOS_STATUS_UNKNOWN', $config
    ->get('nagios.status.unknown'));
}