Compare commits
4
Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
62564a4796 | ||
|
|
f7ffa441f6 | ||
|
|
857be83724 | ||
|
|
de9b9c4a35 |
+5
-1
@@ -216,15 +216,19 @@ func (b *bridge) handle(w http.ResponseWriter, r *http.Request) {
|
||||
case 1: // UP
|
||||
tid, exists := b.open[k.Monitor.Name]
|
||||
if !exists {
|
||||
// restarts wipe the in-memory map; search GLPI for an open ticket
|
||||
tid, _ = b.glpi.openTicketFor(k.Monitor.Name)
|
||||
if tid == 0 {
|
||||
return
|
||||
}
|
||||
}
|
||||
delete(b.open, k.Monitor.Name)
|
||||
go func() {
|
||||
fu := fmt.Sprintf("RECOVERY: monitor %s back UP at %s. Ticket auto-closing as solved with recovery evidence.", k.Monitor.Name, k.Heartbeat.Time)
|
||||
if err := b.glpi.followup(tid, fu); err != nil {
|
||||
log.Printf("followup failed (continuing to solve): %v", err)
|
||||
}
|
||||
if err := b.glpi.do("POST", fmt.Sprintf("/Ticket/%d", tid), map[string]any{"input": map[string]any{"status": 11}}, nil); err != nil { // 11 = solved
|
||||
if err := b.glpi.do("PUT", fmt.Sprintf("/Ticket/%d", tid), map[string]any{"input": map[string]any{"status": 5}}, nil); err != nil { // ticket status 5 = solved
|
||||
log.Printf("solve failed: %v", err)
|
||||
}
|
||||
}()
|
||||
|
||||
Reference in New Issue
Block a user