// Bring in the environmant details
var sensuEnv = new(sensuhandler.EnvDetails)

// main entry point
var handlerElasticsearchStatusCmd = &cobra.Command{
	Use:   "handlerElasticsearchStatus --index <index> --host <host> --port <port>",
	Short: "This will input a single record for each check result given, overwriting the currect record.",
	Long: `This will take a single check result and create a key based upon the host name and
  the check name. This key will remain consistent so that only the latest status will be available in
  the index. This is designed to allow the creation of current dashboards from Kibana or Dashing.`,

	Run: func(sensupluginses *cobra.Command, args []string) {

		// read in the event data from the sensu server
		sensuEvent := new(sensuhandler.SensuEvent)
		sensuEvent = sensuEvent.AcquireSensuEvent()

		// set the environment this is running in (prd, dev,stg)
		sensuEnv = sensuEnv.SetSensuEnv()

		// Create a client
		client, err := elastic.NewClient(
			elastic.SetURL("http://" + esHost + ":" + esPort),
		)
		if err != nil {
			syslogLog.WithFields(logrus.Fields{
				"check":   "sensupluginses",
				"client":  host,
				"version": version.AppVersion(),
				"error":   err,
		// Bring in the environmant details
		sensuEnv := new(sensuhandler.EnvDetails)
		sensuEnv = sensuEnv.SetSensuEnv()

		if slackToken == "" {
			syslogLog.WithFields(logrus.Fields{
				"check":      "sensupluginsslack",
				"client":     host,
				"version":    version.AppVersion(),
				"slackToken": slackToken,
			}).Error(`Please enter a valid slack token`)
			sensuutil.Exit("RUNTIMEERROR")
		}
		// read in the event data from the sensu server
		sensuEvent := new(sensuhandler.SensuEvent)
		sensuEvent = sensuEvent.AcquireSensuEvent()

		// This is done with an api token not an incoming webhook to a specific channel
		api := slack.New(slackToken)
		params := slack.PostMessageParameters{}
		// Build an attachment message for sending to the specified slack channel
		attachment := slack.Attachment{
			Color: sensuhandler.SetColor(sensuEvent.Check.Status),

			Fields: []slack.AttachmentField{
				slack.AttachmentField{
					Title: "Monitored Instance",
					Value: sensuEvent.AcquireMonitoredInstance(),
					Short: true,
				},