Handle empty targets case in Evaluate with StatusUnknown
This commit is contained in:
parent
a2ebf17774
commit
b147fa2f31
1 changed files with 11 additions and 0 deletions
|
|
@ -67,7 +67,18 @@ const (
|
|||
)
|
||||
|
||||
// Evaluate checks the ping data against the given thresholds.
|
||||
// StatusUnknown indicates the check could not be performed.
|
||||
const StatusUnknown = 0
|
||||
|
||||
func Evaluate(data *PingData, warningRTT, criticalRTT, warningPacketLoss, criticalPacketLoss float64) EvaluateResult {
|
||||
if len(data.Targets) == 0 {
|
||||
return EvaluateResult{
|
||||
Status: StatusUnknown,
|
||||
Message: "No targets to ping",
|
||||
Code: "ping_no_targets",
|
||||
}
|
||||
}
|
||||
|
||||
overallStatus := StatusOK
|
||||
var summaryParts []string
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue