Report new incident and set as fixed

This commit is contained in:
Matej Kramny
2015-07-19 21:32:26 +01:00
parent a710944218
commit b609679993
2 changed files with 7 additions and 20 deletions

View File

@@ -100,15 +100,12 @@ func (monitor *Monitor) AnalyseData() {
}
if monitor.LastFailReason != nil {
monitor.Incident.Message += "\n\n" + *monitor.LastFailReason
monitor.Incident.Message += "\n\n - " + *monitor.LastFailReason
}
// set investigating status
monitor.Incident.SetInvestigating()
// lookup relevant incident
monitor.Incident.GetSimilarIncidentID()
// create/update incident
monitor.Incident.Send()
monitor.Incident.UpdateComponent()
@@ -116,8 +113,12 @@ func (monitor *Monitor) AnalyseData() {
// was down, created an incident, its now ok, make it resolved.
Logger.Println("Updating incident to resolved...")
// Add resolved message
monitor.Incident.Message += "\n\n-\n\nResolved at " + time.Now().String()
component_id := json.Number(strconv.Itoa(*monitor.ComponentID))
monitor.Incident = &Incident{
Name: monitor.Incident.Name,
Message: monitor.Name + " check succeeded",
ComponentID: &component_id,
}
monitor.Incident.SetFixed()
monitor.Incident.Send()