function nagios_nagios_settings in Nagios Monitoring 7
Same name and namespace in other branches
- 8 nagios.module \nagios_nagios_settings()
- 5 nagios.module \nagios_nagios_settings()
- 6 nagios.module \nagios_nagios_settings()
Implements hook_nagios_settings().
File
- ./
nagios.module, line 438
Code
function nagios_nagios_settings() {
foreach (nagios_functions() as $function => $description) {
$var = 'nagios_func_' . $function;
$form[$var] = [
'#type' => 'checkbox',
'#title' => $function,
'#default_value' => variable_get($var, TRUE),
'#description' => $description,
];
}
$group = 'thresholds';
$form[$group] = [
'#type' => 'fieldset',
'#collapsible' => TRUE,
'#collapsed' => FALSE,
'#title' => t('Thresholds'),
'#description' => t('Thresholds for reporting critical alerts to Nagios.'),
];
$form[$group]['nagios_cron_duration'] = [
'#type' => 'textfield',
'#title' => t('Cron duration'),
'#default_value' => variable_get('nagios_cron_duration', 60),
'#description' => t('Issue a critical alert when cron has not been running for this duration (in minutes). Default is 60 minutes.'),
];
if (module_exists('elysia_cron')) {
$form[$group]['nagios_elysia_cron_duration'] = [
'#type' => 'textfield',
'#title' => t('Elysia cron duration'),
'#default_value' => variable_get('nagios_elysia_cron_duration', 60),
'#description' => t('Issue a critical alert when elysia cron has not been running for this duration (in minutes). Default is 60 minutes.'),
];
}
$states_without_ok = array_diff_key(nagios_status(), [
NAGIOS_STATUS_OK => 'OK',
]);
$form[$group]['nagios_min_report_severity'] = [
'#type' => 'select',
'#title' => t('Minimum report severity'),
'#default_value' => variable_get('nagios_min_report_severity', NAGIOS_STATUS_WARNING),
'#options' => $states_without_ok,
'#description' => t('Issue an alert only for this minimum severity, not for lower severities.'),
];
return $form;
}