function login_security_nagios in Login Security 7
Same name and namespace in other branches
- 6 login_security.module \login_security_nagios()
Implements hook_nagios().
File
- ./
login_security.module, line 522 - Login Security
Code
function login_security_nagios() {
$return = array(
'key' => 'login_security',
);
// Get the token variables.
$variables = _login_security_get_variables_by_name('anonymous');
// Check the threshold_notified flag for the module status.
$condition = variable_get('login_security_threshold_notified', 'bogus');
if ($condition !== 'bogus') {
// Attack is happening.
if ($condition) {
$status = NAGIOS_STATUS_CRITICAL;
$text = login_security_t(LOGIN_SECURITY_LOGIN_ACTIVITY_EMAIL_SUBJECT, $variables);
}
else {
$status = NAGIOS_STATUS_OK;
$text = '';
}
}
else {
$status = NAGIOS_STATUS_UNKNOWN;
$text = t("Please check if the drupal variable login_security_threshold_notified exists.");
}
// Build the return data.
$return['login_security'] = array(
'status' => $status,
'type' => 'state',
'text' => $text,
);
return $return;
}