Fail2ban is installed on one of the servers, I'm able to ban every IP that try to log in.
I'm using the check_log plugin of Nagios to capture the last line of the fail2ban.log, it compares to the fail2ban.log.old and report the Warning state when detects the word "ban".
It works, thing is I can't let it do one check only and reset to OK state after. It keeps sending me email (and showing me warning) about the same banned IP, (which now is not banned anymore).
I created on Nagios server a service called log-service just for this, where
passive_checks_enabled 0
is_volatile 1
max_check_attempts 1
retry_check_interval 2
It does check the service every 2 minutes, but it's always reporting a warning state (and I collected 19 emails for now).
Can somebody tell me what is wrong? Or a better method if mine is not the best? I don't think there is need to post any log but if you ask I'll just post it.
EDIT: The service definition (re-Edited)
define service{
name log-service
active_checks_enabled 1 ; Active service checks are enabled
passive_checks_enabled 0 ; Passive service checks are enabled/accepted
parallelize_check 1 ; Active service checks should be parallelized (disabling this can lead to major performance problems)
obsess_over_service 1 ; We should obsess over this service (if necessary)
check_freshness 0 ; Default is to NOT check service 'freshness'
notifications_enabled 1 ; Service notifications are enabled
event_handler_enabled 1 ; Service event handler is enabled
flap_detection_enabled 0 ; Flap detection is enabled
process_perf_data 1 ; Process performance data
retain_status_information 1 ; Retain status information across program restarts
retain_nonstatus_information 1 ; Retain non-status information across program restarts
is_volatile 1 ; The service is not volatile
check_period 24x7 ; The service can be checked at any time of the day
max_check_attempts 1 ; Re-check the service up to 1 time in order to determine its final (hard) state
check_interval 2 ; Check the service every 2 minutes under normal conditions
retry_interval 2 ; Re-check the service every two minutes until a hard state can be determined
contact_groups admins ; Notifications get sent out to everyone in the 'admins' group
notification_options w,u,c,r ; Send notifications about warning, unknown, critical, and recovery events
notification_interval 0 ; Re-notify about service problems every hour
notification_period 24x7 ; Notifications can be sent out at any time
register 0
}
0 Answers