You are here

function nagios_settings in Nagios Monitoring 5

Same name and namespace in other branches
  1. 6 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 82

Code

function nagios_settings() {
  $group = 'modules';
  $form['nagios_ua'] = array(
    '#type' => 'textfield',
    '#title' => t('Unique ID'),
    '#default_value' => variable_get('nagios_ua', 'Nagios'),
    '#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[$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);
}