func main() {

	viper.SetConfigName("traffic")
	viper.AddConfigPath("/etc/ditas/")
	viper.AddConfigPath("/.config/")
	viper.AddConfigPath(".config/")
	viper.AddConfigPath(".")

	viper.SetDefault("ElasticSearchURL", "http://localhost:9200")

	viper.SetDefault("ElasticBasicAuth", false)
	viper.SetDefault("ElasticUser", "")
	viper.SetDefault("ElasticPassword", "")

	viper.SetDefault("windowTime", 1)
	viper.SetDefault("VDCName", "dummyVDC")

	err := viper.ReadInConfig()
	if err != nil {
		log.Errorf("Fatal error config file: %s \n", err)
	}

	log.Infof("config file used @ %s", viper.ConfigFileUsed())

	viper.RegisterAlias("elastic", "ElasticSearchURL")

	flag.String("elastic", "http://localhost:9200", "used to define the elasticURL")
	flag.Int("wt", 1, "wait time for each monitoring window")
	flag.Bool("verbose", false, "enable verbose logging")
	flag.Bool("trace", false, "enable very verbose logging")

	pflag.CommandLine.AddGoFlagSet(flag.CommandLine)
	pflag.Parse()
	viper.BindPFlags(pflag.CommandLine)

	if viper.GetBool("trace") {
		viper.Set("verbose", true)
	}

	if viper.GetBool("verbose") {
		logger.SetLevel(logrus.DebugLevel)
	}

	throughputagent.SetLogger(logger)
	throughputagent.SetLog(log)

	agent, err := throughputagent.NewThroughputAgent()

	if err != nil {
		log.Fatal(err)
	}

	agent.Run()
}
/*
TODO:
	- Logging (like always)
	- push to Elastic
	- failsafe
*/
Logging (like always)
push to Elastic
failsafe
/ * TODO : - Logging ( like always ) - push to Elastic - failsafe * /
func main() {
	viper.SetConfigName("traffic")
	viper.AddConfigPath("/etc/ditas/")
	viper.AddConfigPath("/.config/")
	viper.AddConfigPath(".config/")
	viper.AddConfigPath(".")
	viper.SetDefault("ElasticSearchURL", "http://localhost:9200")
	viper.SetDefault("ElasticBasicAuth", false)
	viper.SetDefault("ElasticUser", "")
	viper.SetDefault("ElasticPassword", "")
	viper.SetDefault("windowTime", 1)
	viper.SetDefault("VDCName", "dummyVDC")
	err := viper.ReadInConfig()
	if err != nil {
		log.Errorf("Fatal error config file: %s \n", err)
	}
	log.Infof("config file used @ %s", viper.ConfigFileUsed())
	viper.RegisterAlias("elastic", "ElasticSearchURL")
	flag.String("elastic", "http://localhost:9200", "used to define the elasticURL")
	flag.Int("wt", 1, "wait time for each monitoring window")
	flag.Bool("verbose", false, "enable verbose logging")
	flag.Bool("trace", false, "enable very verbose logging")
	pflag.CommandLine.AddGoFlagSet(flag.CommandLine)
	pflag.Parse()
	viper.BindPFlags(pflag.CommandLine)
	if viper.GetBool("trace") {
		viper.Set("verbose", true)
	}
	if viper.GetBool("verbose") {
		logger.SetLevel(logrus.DebugLevel)
	}
	throughputagent.SetLogger(logger)
	throughputagent.SetLog(log)
	agent, err := throughputagent.NewThroughputAgent()
	if err != nil {
		log.Fatal(err)
	}
	agent.Run()
}
func main ( ) { viper . SetConfigName ( " " ) viper . AddConfigPath ( " " ) viper . AddConfigPath ( " " ) viper . AddConfigPath ( " " ) viper . AddConfigPath ( " " ) viper . SetDefault ( " " , " " ) viper . SetDefault ( " " , false ) viper . SetDefault ( " " , " " ) viper . SetDefault ( " " , " " ) viper . SetDefault ( " " , 1 ) viper . SetDefault ( " " , " " ) err := viper . ReadInConfig ( ) if err != nil { log . Errorf ( " \n " , err ) } log . Infof ( " " , viper . ConfigFileUsed ( ) ) viper . RegisterAlias ( " " , " " ) flag . String ( " " , " " , " " ) flag . Int ( " " , 1 , " " ) flag . Bool ( " " , false , " " ) flag . Bool ( " " , false , " " ) pflag . CommandLine . AddGoFlagSet ( flag . CommandLine ) pflag . Parse ( ) viper . BindPFlags ( pflag . CommandLine ) if viper . GetBool ( " " ) { viper . Set ( " " , true ) } if viper . GetBool ( " " ) { logger . SetLevel ( logrus . DebugLevel ) } throughputagent . SetLogger ( logger ) throughputagent . SetLog ( log ) agent , err := throughputagent . NewThroughputAgent ( ) if err != nil { log . Fatal ( err ) } agent . Run ( ) }
Logging (like always)
push to Elastic
failsafe
Logging ( like always ) push to Elastic failsafe