sending notifications on failure.
This commit is contained in:
@@ -1,14 +1,12 @@
|
||||
package handler
|
||||
|
||||
import (
|
||||
"fmt"
|
||||
"github.com/analogj/scrutiny/webapp/backend/pkg/config"
|
||||
dbModels "github.com/analogj/scrutiny/webapp/backend/pkg/models/db"
|
||||
"github.com/analogj/scrutiny/webapp/backend/pkg/notify"
|
||||
"github.com/gin-gonic/gin"
|
||||
"github.com/sirupsen/logrus"
|
||||
"net/http"
|
||||
"os"
|
||||
)
|
||||
|
||||
// Send test notification
|
||||
@@ -17,15 +15,14 @@ func SendTestNotification(c *gin.Context) {
|
||||
logger := c.MustGet("LOGGER").(logrus.FieldLogger)
|
||||
|
||||
testNotify := notify.Notify{
|
||||
Logger: logger,
|
||||
Config: appConfig,
|
||||
Payload: notify.Payload{
|
||||
Mailer: os.Args[0],
|
||||
Subject: fmt.Sprintf("Scrutiny SMART error (EmailTest) detected on disk: XXXXX"),
|
||||
FailureType: "EmailTest",
|
||||
Device: "/dev/sda",
|
||||
DeviceType: "ata",
|
||||
DeviceString: "/dev/sda",
|
||||
Message: "TEST EMAIL from smartd for device: /dev/sda",
|
||||
DeviceSerial: "FAKEWDDJ324KSO",
|
||||
DeviceType: dbModels.DeviceProtocolAta,
|
||||
DeviceName: "/dev/sda",
|
||||
Test: true,
|
||||
},
|
||||
}
|
||||
err := testNotify.Send()
|
||||
|
||||
Reference in New Issue
Block a user