feat: alerting if filesystem is not found
This commit is contained in:
parent
dee08b808b
commit
32ce383db8
@ -3,6 +3,7 @@ package check
|
|||||||
import (
|
import (
|
||||||
"fmt"
|
"fmt"
|
||||||
"go/slack-bot/pkg/notify"
|
"go/slack-bot/pkg/notify"
|
||||||
|
"log"
|
||||||
"regexp"
|
"regexp"
|
||||||
"strconv"
|
"strconv"
|
||||||
"strings"
|
"strings"
|
||||||
@ -83,6 +84,7 @@ func (dc *DfChecker) FileSystemUsedCheck(dfOut DfStdout, param DfParameter) noti
|
|||||||
message := notify.Message{
|
message := notify.Message{
|
||||||
ShouldNotify: false,
|
ShouldNotify: false,
|
||||||
}
|
}
|
||||||
|
found := false
|
||||||
for _, line := range dfOut {
|
for _, line := range dfOut {
|
||||||
if line.Filesystem == param.FileSystemName {
|
if line.Filesystem == param.FileSystemName {
|
||||||
if line.PourcentUsed > param.CriticalPourcent {
|
if line.PourcentUsed > param.CriticalPourcent {
|
||||||
@ -92,6 +94,13 @@ func (dc *DfChecker) FileSystemUsedCheck(dfOut DfStdout, param DfParameter) noti
|
|||||||
ShouldNotify: true,
|
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
|
return message
|
||||||
|
Loading…
Reference in New Issue
Block a user