notify

package
v0.4.4 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: May 13, 2022 License: MIT Imports: 15 Imported by: 0

Documentation

Index

Constants

View Source
const NotifyFailureTypeEmailTest = "EmailTest"
View Source
const NotifyFailureTypeSmartErrorLog = "SmartErrorLog"
View Source
const NotifyFailureTypeSmartFailure = "SmartFailure"
View Source
const NotifyFailureTypeSmartPrefail = "SmartPreFailure"
View Source
const NotifyFailureTypeSmartSelfTest = "SmartSelfTestLog"

Variables

This section is empty.

Functions

This section is empty.

Types

type Notify

type Notify struct {
	Logger  logrus.FieldLogger
	Config  config.Interface
	Payload Payload
}

func (*Notify) GenShoutrrrNotificationParams

func (n *Notify) GenShoutrrrNotificationParams(shoutrrrUrl string) (string, *shoutrrrTypes.Params, error)

func (*Notify) Send

func (n *Notify) Send() error

func (*Notify) SendScriptNotification

func (n *Notify) SendScriptNotification(scriptUrl string) error

func (*Notify) SendShoutrrrNotification

func (n *Notify) SendShoutrrrNotification(shoutrrrUrl string) error

func (*Notify) SendWebhookNotification

func (n *Notify) SendWebhookNotification(webhookUrl string) error

type Payload

type Payload struct {
	Date         string `json:"date"`          //populated by Send function.
	FailureType  string `json:"failure_type"`  //EmailTest, SmartFail, ScrutinyFail
	DeviceType   string `json:"device_type"`   //ATA/SCSI/NVMe
	DeviceName   string `json:"device_name"`   //dev/sda
	DeviceSerial string `json:"device_serial"` //WDDJ324KSO
	Test         bool   `json:"test"`          // false

	//should not be populated
	Subject string `json:"subject"`
	Message string `json:"message"`
}

TODO: include host and/or user label for device.

func (*Payload) GenerateMessage

func (p *Payload) GenerateMessage() string

func (*Payload) GenerateSubject

func (p *Payload) GenerateSubject() string

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL