Browse Source

feat: alerting if filesystem is not found

master
RouxAntoine 3 weeks ago
parent
commit
32ce383db8
Signed by: antoine <antoinroux@hotmail.fr> GPG Key ID: 098FB66FC0475E70
1 changed files with 9 additions and 0 deletions
  1. +9
    -0
      pkg/check/df.go

+ 9
- 0
pkg/check/df.go View File

@@ -3,6 +3,7 @@ package check
import (
"fmt"
"go/slack-bot/pkg/notify"
"log"
"regexp"
"strconv"
"strings"
@@ -83,6 +84,7 @@ func (dc *DfChecker) FileSystemUsedCheck(dfOut DfStdout, param DfParameter) noti
message := notify.Message{
ShouldNotify: false,
}
found := false
for _, line := range dfOut {
if line.Filesystem == param.FileSystemName {
if line.PourcentUsed > param.CriticalPourcent {
@@ -92,6 +94,13 @@ func (dc *DfChecker) FileSystemUsedCheck(dfOut DfStdout, param DfParameter) noti
ShouldNotify: true,
}
}
found = true
}
}
if !found {
message = notify.Message{
Content: fmt.Sprintf("%s : fs '%s' not found\n", dc.alertingMessage, param.FileSystemName),
ShouldNotify: true,
}
}
return message


Loading…
Cancel
Save