"esIndex": esIndex, }).Error(`Could not create an elasticsearch index`) } } // 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,
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(), Short: true, }, slack.AttachmentField{ Title: "Sensu Environment", Value: sensuhandler.DefineSensuEnv(sensuEnv.Sensu.Environment), Short: true, }, slack.AttachmentField{ Title: "Check Event ID", Value: sensuEvent.ID, Short: true, }, slack.AttachmentField{ Title: "Check Output", Value: sensuhandler.CleanOutput(sensuEvent.Check.Output), Short: true, }, }, } params.Attachments = []slack.Attachment{attachment}