Skip to content

Commit 4bedb3c

Browse files
authored
Merge pull request #9 from NUCsimple/master
fix event message
2 parents a6f12f6 + 7c61a97 commit 4bedb3c

File tree

4 files changed

+7
-4
lines changed

4 files changed

+7
-4
lines changed

pkg/custompluginmonitor/custom_plugin_monitor.go

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -231,6 +231,7 @@ func (c *customPluginMonitor) generateStatus(result cpmtypes.Result) *types.Stat
231231
status,
232232
newReason,
233233
timestamp,
234+
result.Message,
234235
)
235236

236237
if status == types.True {

pkg/systemlogmonitor/log_monitor.go

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -193,6 +193,7 @@ func (l *logMonitor) generateStatus(logs []*logtypes.Log, rule systemlogtypes.Ru
193193
types.True,
194194
rule.Reason,
195195
timestamp,
196+
condition.Message,
196197
))
197198
}
198199
condition.Status = types.True

pkg/systemlogmonitor/log_monitor_test.go

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -85,6 +85,7 @@ func TestGenerateStatusForConditions(t *testing.T) {
8585
types.True,
8686
"test reason",
8787
time.Unix(1000, 1000),
88+
"message 1",
8889
)},
8990
Conditions: []types.Condition{
9091
{

pkg/util/helpers.go

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -28,21 +28,21 @@ import (
2828
var osReleasePath = "/etc/os-release"
2929

3030
// GenerateConditionChangeEvent generates an event for condition change.
31-
func GenerateConditionChangeEvent(t string, status types.ConditionStatus, reason string, timestamp time.Time) types.Event {
31+
func GenerateConditionChangeEvent(t string, status types.ConditionStatus, reason string, timestamp time.Time, msg string) types.Event {
3232
return types.Event{
3333
Severity: types.Info,
3434
Timestamp: timestamp,
3535
Reason: reason,
36-
Message: fmt.Sprintf("Node condition %s is now: %s, reason: %s", t, status, reason),
36+
Message: fmt.Sprintf("Node condition %s is now: %s, reason: %s, msg: %s", t, status, reason, msg),
3737
}
3838
}
3939

40-
func GenerateWarnConditionChangeEvent(t string, status types.ConditionStatus, reason string, timestamp time.Time) types.Event {
40+
func GenerateWarnConditionChangeEvent(t string, status types.ConditionStatus, reason string, timestamp time.Time, msg string) types.Event {
4141
return types.Event{
4242
Severity: types.Warn,
4343
Timestamp: timestamp,
4444
Reason: reason,
45-
Message: fmt.Sprintf("Node condition %s is now: %s, reason: %s", t, status, reason),
45+
Message: fmt.Sprintf("Node condition %s is now: %s, reason: %s, msg: %s", t, status, reason, msg),
4646
}
4747
}
4848

0 commit comments

Comments
 (0)