46 lines
1.3 KiB
Go
46 lines
1.3 KiB
Go
package models
|
|
|
|
type AlertItem struct {
|
|
Id int64 `json:"id" db:"id"`
|
|
ContactPointId int64 `json:"contactPointId" db:"contact_point_id"`
|
|
Name string `json:"name" db:"name"`
|
|
Condition string `json:"condition" db:"condition"`
|
|
CustomMessage string `json:"customMessage" db:"custom_message"`
|
|
|
|
/* how long does the condition have to be true for the alert to go off */
|
|
TriggerInterval int64 `json:"triggerInterval" db:"trigger_interval"`
|
|
|
|
/* current alert status, possible values: good, pending, alerting */
|
|
LastStatus AlertStatus `json:"lastStatus" db:"last_status"`
|
|
/* time at which was status last changed */
|
|
LastStatusAt int64 `json:"lastStatusAt" db:"last_status_at"`
|
|
}
|
|
|
|
type AlertConditionSensorValue struct {
|
|
SensorId int64 `json:"sensorId"`
|
|
Condition string `json:"condition"`
|
|
Value float64 `json:"value"`
|
|
}
|
|
|
|
type AlertConditionSensorLastContact struct {
|
|
SensorId int64 `json:"sensorId"`
|
|
Value float64 `json:"value"`
|
|
ValueUnit string `json:"valueUnit"`
|
|
}
|
|
|
|
type AlertConditionType string
|
|
|
|
const (
|
|
AlertConditionSensorValueType = "sensor_value"
|
|
AlertConditionSensorLastContactType = "sensor_last_contact"
|
|
)
|
|
|
|
type AlertStatus string
|
|
|
|
const (
|
|
AlertStatusOk = "ok"
|
|
AlertStatusAlertPending = "alert_pending"
|
|
AlertStatusAlerting = "alerting"
|
|
AlertStatusOkPending = "ok_pending"
|
|
)
|