Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

suppress only normal notifications from service parents #446

Merged
merged 1 commit into from
Jan 31, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
29 changes: 15 additions & 14 deletions src/naemon/notifications.c
Original file line number Diff line number Diff line change
Expand Up @@ -608,18 +608,6 @@ int check_service_notification_viability(service *svc, int type, int options)

temp_host = svc->host_ptr;

/* if all parents are bad (usually just one), we shouldn't notify */
if (svc->parents) {
sm = svc->parents;
while (sm && sm->service_ptr->current_state != STATE_OK) {
sm = sm->next;
}
if (sm == NULL) {
LOG_SERVICE_NSR(NSR_BAD_PARENTS);
return ERROR;
}
}

/* if the service has no notification period, inherit one from the host */
temp_period = svc->notification_period_ptr;
if (temp_period == NULL) {
Expand Down Expand Up @@ -669,7 +657,6 @@ int check_service_notification_viability(service *svc, int type, int options)
}



/****************************************/
/*** SPECIAL CASE FOR ACKNOWLEGEMENTS ***/
/****************************************/
Expand All @@ -687,7 +674,6 @@ int check_service_notification_viability(service *svc, int type, int options)
return OK;
}


/****************************************/
/*** SPECIAL CASE FOR FLAPPING ALERTS ***/
/****************************************/
Expand Down Expand Up @@ -735,6 +721,21 @@ int check_service_notification_viability(service *svc, int type, int options)
return OK;
}

/******************************************************/
/*** CHECK SERVICE PARENTS FOR NORMAL NOTIFICATIONS ***/
/******************************************************/
/* if all parents are bad (usually just one), we shouldn't notify */
/* but do not prevent recovery notifications */
if (svc->parents && svc->current_state != STATE_OK) {
sm = svc->parents;
while (sm && sm->service_ptr->current_state != STATE_OK) {
sm = sm->next;
}
if (sm == NULL) {
LOG_SERVICE_NSR(NSR_BAD_PARENTS);
return ERROR;
}
}

/****************************************/
/*** NORMAL NOTIFICATIONS ***************/
Expand Down
Loading