Skip to content

Commit ccf649c

Browse files
committed
add warning condition
1 parent 7333b4f commit ccf649c

File tree

2 files changed

+10
-1
lines changed

2 files changed

+10
-1
lines changed

pkg/custompluginmonitor/custom_plugin_monitor.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -140,7 +140,7 @@ func (c *customPluginMonitor) generateStatus(result cpmtypes.Result) *types.Stat
140140
}
141141
}
142142

143-
events = append(events, util.GenerateConditionChangeEvent(
143+
events = append(events, util.GenerateWarnConditionChangeEvent(
144144
condition.Type,
145145
status,
146146
defaultConditionReason,

pkg/util/helpers.go

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -33,6 +33,15 @@ func GenerateConditionChangeEvent(t string, status types.ConditionStatus, reason
3333
}
3434
}
3535

36+
func GenerateWarnConditionChangeEvent(t string, status types.ConditionStatus, reason string, timestamp time.Time) types.Event {
37+
return types.Event{
38+
Severity: types.Warn,
39+
Timestamp: timestamp,
40+
Reason: reason,
41+
Message: fmt.Sprintf("Node condition %s is now: %s, reason: %s", t, status, reason),
42+
}
43+
}
44+
3645
func GetUptimeDuration() (time.Duration, error) {
3746
var info syscall.Sysinfo_t
3847
if err := syscall.Sysinfo(&info); err != nil {

0 commit comments

Comments
 (0)