// 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, "esHost": esHost, "esPort": esPort, }).Error(`Could not create an elasticsearch client`)