Skip to content

Add notifications for collector failures #945

Description

@kaysond

We should add an API endpoint so the collector can report smartctl --scan and smartctl --info errors. The endpoint can trigger an opt-out notification. If the backend receives a smartctl --xall json object indicating an error (see #944), a notification should also be sent.

This needs a new handler, a new route:

func (ae *AppEngine) Setup(logger *logrus.Entry) *gin.Engine {
r := gin.New()
r.Use(middleware.LoggerMiddleware(logger))
r.Use(middleware.RepositoryMiddleware(ae.Config, logger))
r.Use(middleware.ConfigMiddleware(ae.Config))
r.Use(gin.Recovery())
basePath := ae.Config.GetString("web.listen.basepath")
logger.Debugf("basepath: %s", basePath)
base := r.Group(basePath)
{
api := base.Group("/api")
{
api.GET("/health", handler.HealthCheck)
api.POST("/health/notify", handler.SendTestNotification) //check if notifications are configured correctly
api.POST("/devices/register", handler.RegisterDevices) //used by Collector to register new devices and retrieve filtered list
api.GET("/summary", handler.GetDevicesSummary) //used by Dashboard
api.GET("/summary/temp", handler.GetDevicesSummaryTempHistory) //used by Dashboard (Temperature history dropdown)
api.POST("/device/:wwn/smart", handler.UploadDeviceMetrics) //used by Collector to upload data
api.POST("/device/:wwn/selftest", handler.UploadDeviceSelfTests)
api.GET("/device/:wwn/details", handler.GetDeviceDetails) //used by Details
api.POST("/device/:wwn/archive", handler.ArchiveDevice) //used by UI to archive device
api.POST("/device/:wwn/unarchive", handler.UnarchiveDevice) //used by UI to unarchive device
api.DELETE("/device/:wwn", handler.DeleteDevice) //used by UI to delete device
api.GET("/settings", handler.GetSettings) //used to get settings
api.POST("/settings", handler.SaveSettings) //used to save settings
}
}

and a new setting, including a UI element and database migration. See bdbe13e for an example.

Metadata

Metadata

Assignees

No one assigned

    Labels

    contributor friendlyA well-scoped, approachable issue for someone looking to contribute.enhancementNew feature or requestfrontendIssues that require updating non-typescript frontend code (e.g. css)goIssues that require updating Go codetypescriptIssues that require updating typescript code

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions