You are here

function nagios_settings in Nagios Monitoring 6

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

Callback for the settings page

1 string reference to 'nagios_settings'
nagios_menu in ./nagios.module
Implementation of hook_menu

File

./nagios.module, line 83

Code

function nagios_settings() {
  $group = 'modules';
  $form['nagios_ua'] = array(
    '#type' => 'textfield',
    '#title' => t('Unique ID'),
    '#default_value' => variable_get('nagios_ua', ''),
    '#description' => t('Restrict sending information to requests identified by this Unique ID. You should change this to some unique string for your organization, and configure Nagios accordingly. This makes Nagios data less accessible to curious users. See the README.txt for more details.'),
  );
  $form['nagios_show_outdated_names'] = array(
    '#type' => 'checkbox',
    '#title' => t('Show outdated module/theme name?'),
    '#default_value' => variable_get('nagios_show_outdated_names', TRUE),
  );
  $form['nagios_enable_status_page'] = array(
    '#type' => 'checkbox',
    '#title' => t('Enable status page?'),
    '#default_value' => variable_get('nagios_enable_status_page', TRUE),
  );
  $form['nagios_error_levels'] = array(
    '#type' => 'fieldset',
    '#collapsible' => TRUE,
    '#collapsed' => FALSE,
    '#title' => t('Error levels'),
    '#description' => t('Set the values to be used for error levels when reporting to Nagios.'),
  );
  $form['nagios_error_levels']['nagios_status_ok_value'] = array(
    '#type' => 'textfield',
    '#title' => t('Status OK'),
    '#description' => t('The value to send to Nagios for a Status OK message.'),
    '#default_value' => variable_get('nagios_status_ok_value', 0),
  );
  $form['nagios_error_levels']['nagios_status_warning_value'] = array(
    '#type' => 'textfield',
    '#title' => t('Warning'),
    '#description' => t('The value to send to Nagios for a Warning message.'),
    '#default_value' => variable_get('nagios_status_warning_value', 1),
  );
  $form['nagios_error_levels']['nagios_status_critical_value'] = array(
    '#type' => 'textfield',
    '#title' => t('Critical'),
    '#description' => t('The value to send to Nagios for a Critical message.'),
    '#default_value' => variable_get('nagios_status_critical_value', 2),
  );
  $form['nagios_error_levels']['nagios_status_unknown_value'] = array(
    '#type' => 'textfield',
    '#title' => t('Unknown'),
    '#description' => t('The value to send to Nagios for an Unknown message.'),
    '#default_value' => variable_get('nagios_status_unknown_value', 3),
  );
  $form[$group] = array(
    '#type' => 'fieldset',
    '#collapsible' => TRUE,
    '#collapsed' => FALSE,
    '#title' => t('Modules'),
    '#description' => t('Select the modules that should report their data into Nagios.'),
  );
  foreach (nagios_invoke_all('nagios_info') as $module => $data) {
    $form[$group]['nagios_enable_' . $module] = array(
      '#type' => 'checkbox',
      '#title' => $data['name'] . ' (' . $module . ')',
      '#default_value' => variable_get('nagios_enable_' . $module, TRUE),
    );
  }
  foreach (nagios_invoke_all('nagios_settings') as $module => $module_settings) {
    $form[$module] = array(
      '#type' => 'fieldset',
      '#collapsible' => TRUE,
      '#collapsed' => TRUE,
      '#title' => $module,
    );
    foreach ($module_settings as $element => $data) {
      $form[$module][$element] = $data;
    }
  }
  return system_settings_form($form);
}