+func dispalyAlertAnnotations(t table.Writer, gettableAlert *models.GettableAlert) {
+ var annotationmap map[string]string
+ annotationmap = make(map[string]string)
+ for key, item := range gettableAlert.Annotations {
+ annotationmap[key] = item
+ }
+ t.AppendRow([]interface{}{"alarm_id", annotationmap["alarm_id"]})
+ t.AppendRow([]interface{}{"specific_problem", annotationmap["specific_problem"]})
+ t.AppendRow([]interface{}{"timestamp", annotationmap["timestamp"]})
+ t.AppendRow([]interface{}{"event_type", annotationmap["event_type"]})
+ t.AppendRow([]interface{}{"description", annotationmap["description"]})
+ t.AppendRow([]interface{}{"additional_info", annotationmap["additional_info"]})
+ t.AppendRow([]interface{}{"identifying_info", annotationmap["identifying_info"]})
+ t.AppendRow([]interface{}{"instructions", annotationmap["instructions"]})
+}
+
+func displayAlertLabels(t table.Writer, gettableAlert *models.GettableAlert) {
+ var labelmap map[string]string
+ labelmap = make(map[string]string)
+ for key, item := range gettableAlert.Alert.Labels {
+ labelmap[key] = item
+ }
+ t.AppendRow([]interface{}{"alertname", labelmap["alertname"]})
+ t.AppendRow([]interface{}{"status", labelmap["status"]})
+ t.AppendRow([]interface{}{"severity", labelmap["severity"]})
+ t.AppendRow([]interface{}{"system_name", labelmap["system_name"]})
+ t.AppendRow([]interface{}{"service", labelmap["service"]})
+}
+
+func displaySingleAlert(t table.Writer, gettableAlert *models.GettableAlert) {
+ t.AppendRow([]interface{}{"------------------------------------"})
+ dispalyAlertAnnotations(t, gettableAlert)
+ if gettableAlert.EndsAt != nil {
+ t.AppendRow([]interface{}{"EndsAt", *gettableAlert.EndsAt})
+ }
+ if gettableAlert.Fingerprint != nil {
+ t.AppendRow([]interface{}{"Fingerprint", *gettableAlert.Fingerprint})
+ }
+ for key, item := range gettableAlert.Receivers {
+ if gettableAlert.Receivers != nil {
+ t.AppendRow([]interface{}{key, *item.Name})
+ }
+ }
+ if gettableAlert.StartsAt != nil {
+ t.AppendRow([]interface{}{"StartsAt", *gettableAlert.StartsAt})
+ }
+ if gettableAlert.Status != nil {
+ t.AppendRow([]interface{}{"InhibitedBy", gettableAlert.Status.InhibitedBy})
+ t.AppendRow([]interface{}{"SilencedBy", gettableAlert.Status.SilencedBy})
+ t.AppendRow([]interface{}{"State", *gettableAlert.Status.State})
+ }
+ if gettableAlert.UpdatedAt != nil {
+ t.AppendRow([]interface{}{"UpdatedAt", *gettableAlert.UpdatedAt})
+ }
+ t.AppendRow([]interface{}{"GeneratorURL", gettableAlert.Alert.GeneratorURL})
+ displayAlertLabels(t, gettableAlert)
+}
+