-
Notifications
You must be signed in to change notification settings - Fork 1.4k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[monit] Adding patch to enhance syslog error message generation for m…
…onit alert action when status is failed. (#5720) Why/How I did: Make sure first error syslog is triggered based on FAULT TOLERANCE condition. Added support of repeat clause with alert action. This is used as trigger for generation of periodic syslog error messages if error is persistent Updated the monit conf files with repeat every x cycles for the alert action Signed-off-by: Guohan Lu <[email protected]>
- Loading branch information
Showing
21 changed files
with
118 additions
and
43 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,64 @@ | ||
From 97a5defc6a7fcc6a00f691bb5314ceb8fb7704e9 Mon Sep 17 00:00:00 2001 | ||
From: Abhishek Dosi <[email protected]> | ||
Date: Mon, 26 Oct 2020 11:40:02 -0700 | ||
Subject: [PATCH] Patch on top of commit Patch is addressing these changes:- | ||
|
||
a) Enable repeat keyword for alert action . Using this we can log | ||
syslog error message for persistent failure condition | ||
|
||
b) Make sure error message is loggged if state is changed to fail first time (fault tolerance condition) | ||
or we have repeat clause for alert | ||
|
||
Signed-off-by: Abhishek Dosi <[email protected]> | ||
|
||
--- | ||
src/event.c | 6 +++++- | ||
src/p.y | 8 +++++++- | ||
2 files changed, 12 insertions(+), 2 deletions(-) | ||
|
||
diff --git a/src/event.c b/src/event.c | ||
index ed363ee..9d08fc0 100644 | ||
--- a/src/event.c | ||
+++ b/src/event.c | ||
@@ -336,7 +336,8 @@ static void _handleEvent(Service_T S, Event_T E) { | ||
if (E->state != State_Init || E->state_map & 0x1) { | ||
if (E->state == State_Succeeded || E->state == State_ChangedNot || E->id == Event_Instance || E->id == Event_Action) | ||
LogInfo("'%s' %s\n", S->name, E->message); | ||
- else | ||
+ /* Send Error log if state change to failed for 1st time or if we have repeat clause then do periodically */ | ||
+ else if ((E->state_changed) || (E->state == State_Failed && E->action->failed->repeat && E->count % E->action->failed->repeat == 0)) | ||
LogError("'%s' %s\n", S->name, E->message); | ||
} | ||
if (E->state == State_Init) | ||
return; | ||
diff --git a/src/p.y b/src/p.y | ||
index a57807d..b46b1a1 100644 | ||
--- a/src/p.y | ||
+++ b/src/p.y | ||
@@ -2250,9 +2250,12 @@ repeat : /* EMPTY */ { | ||
} | ||
; | ||
|
||
-action : ALERT { | ||
+action : ALERT repeat{ | ||
$<number>$ = Action_Alert; | ||
} | ||
+ | ALERT { | ||
+ $<number>$ = Action_Alert; | ||
+ } | ||
| EXEC argumentlist repeat { | ||
$<number>$ = Action_Exec; | ||
} | ||
@@ -2281,6 +2284,9 @@ action1 : action { | ||
repeat = 0; | ||
command1 = command; | ||
command = NULL; | ||
+ } else if ($<number>1 == Action_Alert) { | ||
+ repeat1 = repeat; | ||
+ repeat = 0; | ||
} | ||
} | ||
; | ||
-- | ||
2.17.1 | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,2 +1,3 @@ | ||
# This series applies on GIT commit dc9bc1c949125140d967edfc598dfad47eedc552 | ||
0001-used_system_memory_sysdep-Use-MemAvailable-value-if-.patch | ||
0002-change_monit_alert_log_error.patch |