} } // Create an Elasticsearch document. The document type will define the mapping used for the document. doc := make(map[string]interface{}) var docID string docID = sensuhandler.EventName(sensuEvent.Client.Name, sensuEvent.Check.Name) doc["monitored_instance"] = sensuEvent.AcquireMonitoredInstance() doc["sensu_client"] = sensuEvent.Client.Name doc["incident_timestamp"] = time.Unix(sensuEvent.Check.Issued, 0).Format(time.RFC3339) doc["check_name"] = sensuhandler.CreateCheckName(sensuEvent.Check.Name) doc["check_state"] = sensuhandler.DefineStatus(sensuEvent.Check.Status) doc["sensuEnv"] = sensuhandler.DefineSensuEnv(sensuEnv.Sensu.Environment) doc["tags"] = sensuEvent.Check.Tags doc["instance_address"] = sensuEvent.Client.Address doc["check_state_duration"] = sensuhandler.DefineCheckStateDuration() // Add a document to the Elasticsearch index _, err = client.Index(). Index(esIndex). Type(esType). Id(docID). BodyJson(doc). Do() if err != nil { syslogLog.WithFields(logrus.Fields{ "check": "sensupluginses", "client": host, "version": version.AppVersion(), "error": err, "esHost": esHost,
Value: sensuEvent.Check.Name, Short: true, }, slack.AttachmentField{ Title: "Check State", Value: sensuhandler.DefineStatus(sensuEvent.Check.Status), Short: true, }, slack.AttachmentField{ Title: "Event Time (UTC)", Value: time.Unix(sensuEvent.Check.Issued, 0).Format(time.RFC3339), Short: true, }, slack.AttachmentField{ Title: "Check State Duration", Value: strconv.Itoa(sensuhandler.DefineCheckStateDuration()), Short: true, }, slack.AttachmentField{ Title: "Current Threshold", Value: sensuEvent.AcquireThreshold(), Short: true, }, slack.AttachmentField{ Title: "Uchiwa", Value: sensuEnv.AcquireUchiwa(sensuEvent.AcquireMonitoredInstance(), sensuEvent.Check.Name), Short: true, }, slack.AttachmentField{ Title: "Playbook", Value: sensuEvent.AcquirePlaybook(),