Problems logging HARD-SOFT state

Brinkmann, Bastian Bastian.Brinkmann at blanco.de
Wed Apr 16 09:49:12 CEST 2003


Hello

I had the following problem: If Nagios logged a CRITICAL HARD and later a
CRITICAL SOFT error, it only gave its OK to the SOFT error, the HARD error
wasn't fixed. This seems to be an error in Nagios itself. To solve this
problem, I had to edit the sourcecode:

In /opt/nagios-1.0/base/checks.c around line 1010 I found the following:

1005:  /* the host is up, so continue to retry the service check */
1006:                                 else{
1007:
1008:                                        /* this is a soft state */
1009:
temp_service->state_type=SOFT_STATE;
1010:
1011:                                       /* update service state times if
necessary and last state change time */
1012:                                        if(state_change==TRUE)
1013:
update_service_state_times(temp_service);
1014:
1015:                                        /* log the service check retry
*/
1016:
log_service_event(temp_service,SOFT_STATE);
1017:                                       state_was_logged=TRUE;


I just had to add a little if-command:

1005:  /* the host is up, so continue to retry the service check */
1006:                                 else{
1007:
1008:                                        /* this is a soft state */
1009:				if( hard_state_change==FALSE &&
temp_service->state_type!=HARD_STATE )
1010:
temp_service->state_type=SOFT_STATE;
1011:
1012:                                       /* update service state times if
necessary and last state change time */
1013:                                        if(state_change==TRUE)
1014:
update_service_state_times(temp_service);
1015:
1016:                                        /* log the service check retry
*/
1017:
log_service_event(temp_service,SOFT_STATE);
1018:                                       state_was_logged=TRUE;


After compiling (make), I had to stop nagios (/etc/init.d/nagios stop),
copied the new nagios file (/opt/nagios-1.0/base/nagios) to /opt/nagios/bin/
and restarted nagios (/etc/init.d/nagios start). I tested with a client two
times and everything seems to work fine.


-------------------------------------------------------
This sf.net email is sponsored by:ThinkGeek
Welcome to geek heaven.
http://thinkgeek.com/sf
_______________________________________________
Nagios-users mailing list
Nagios-users at lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/nagios-users
::: Please include Nagios version, plugin version (-v) and OS when reporting any issue. 
::: Messages without supporting info will risk being sent to /dev/null





More information about the Users mailing list