|
|
@ -19,10 +19,10 @@ const (
|
|
|
|
type checkType = struct{ description string }
|
|
|
|
type checkType = struct{ description string }
|
|
|
|
|
|
|
|
|
|
|
|
var checkTypes = map[string]checkType{
|
|
|
|
var checkTypes = map[string]checkType{
|
|
|
|
eventMeasurementAge: checkType{"No measurement from %s since %s"},
|
|
|
|
eventMeasurementAge: checkType{"No measurement from %s (%s) since %s"},
|
|
|
|
eventMeasurementValMin: checkType{"Sensor %s reads low value of %s"},
|
|
|
|
eventMeasurementValMin: checkType{"Sensor %s (%s) reads low value of %s"},
|
|
|
|
eventMeasurementValMax: checkType{"Sensor %s reads high value of %s"},
|
|
|
|
eventMeasurementValMax: checkType{"Sensor %s (%s) reads high value of %s"},
|
|
|
|
eventMeasurementValFaulty: checkType{"Sensor %s reads presumably faulty value of %s"},
|
|
|
|
eventMeasurementValFaulty: checkType{"Sensor %s (%s) reads presumably faulty value of %s"},
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
type FaultyValue struct {
|
|
|
|
type FaultyValue struct {
|
|
|
@ -58,6 +58,7 @@ type Box struct {
|
|
|
|
Name string `json:"name"`
|
|
|
|
Name string `json:"name"`
|
|
|
|
Sensors []struct {
|
|
|
|
Sensors []struct {
|
|
|
|
Id string `json:"_id"`
|
|
|
|
Id string `json:"_id"`
|
|
|
|
|
|
|
|
Phenomenon string `json:"title"`
|
|
|
|
Type string `json:"sensorType"`
|
|
|
|
Type string `json:"sensorType"`
|
|
|
|
LastMeasurement *struct {
|
|
|
|
LastMeasurement *struct {
|
|
|
|
Value string `json:"value"`
|
|
|
|
Value string `json:"value"`
|
|
|
@ -81,6 +82,7 @@ func (box Box) RunChecks() ([]CheckResult, error) {
|
|
|
|
var (
|
|
|
|
var (
|
|
|
|
status = CheckOk
|
|
|
|
status = CheckOk
|
|
|
|
target = s.Id
|
|
|
|
target = s.Id
|
|
|
|
|
|
|
|
targetName = s.Phenomenon
|
|
|
|
value string
|
|
|
|
value string
|
|
|
|
)
|
|
|
|
)
|
|
|
|
|
|
|
|
|
|
|
@ -133,6 +135,7 @@ func (box Box) RunChecks() ([]CheckResult, error) {
|
|
|
|
Threshold: event.Threshold,
|
|
|
|
Threshold: event.Threshold,
|
|
|
|
Event: event.Type,
|
|
|
|
Event: event.Type,
|
|
|
|
Target: target,
|
|
|
|
Target: target,
|
|
|
|
|
|
|
|
TargetName: targetName,
|
|
|
|
Value: value,
|
|
|
|
Value: value,
|
|
|
|
Status: status,
|
|
|
|
Status: status,
|
|
|
|
})
|
|
|
|
})
|
|
|
|