[Nagios-devel] RE: Problems logging HARD-SOFT state

Support forum for Nagios Core, Nagios Plugins, NCPA, NRPE, NSCA, NDOUtils and more. Engage with the community of users including those using the open source solutions.
Locked
Guest

[Nagios-devel] RE: Problems logging HARD-SOFT state

Post by Guest »

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 post was automatically imported from historical nagios-devel mailing list archives
Original poster: Bastian.Brinkmann@blanco.de
Locked