You are here

function nagios_nagios in Nagios Monitoring 7

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

Implements hook_nagios().

Parameters

string $id: Name of the function to call. If $id is empty, all are called. The $id can be submitted by appending /nagios/cron to the HTTP status page.

Return value

array

File

./nagios.module, line 633

Code

function nagios_nagios($id = '') {
  $status = [];

  /** @var callable $func */
  if (!empty($id) && variable_get('nagios_func_' . $id, FALSE)) {
    $func = 'nagios_check_' . $id;
    $result = $func();
    $status[$result['key']] = $result['data'];
  }
  else {
    foreach (nagios_functions() as $function => $description) {
      if (variable_get('nagios_func_' . $function, TRUE)) {
        $func = 'nagios_check_' . $function;
        $result = $func();
        $status[$result['key']] = $result['data'];
      }
    }
  }
  return $status;
}