Пример #1
0
func main() {

	// Create Beater object
	pb := &Packetbeat{}

	// Initi beat objectefile
	b := beat.NewBeat(Name, Version, pb)

	// Additional command line args are used to overwrite config options
	pb.CmdLineArgs = fetchAdditionalCmdLineArgs()

	// Base CLI flags
	b.CommandLineSetup()

	// Beat CLI flags
	pb.CliFlags(b)

	// Loads base config
	b.LoadConfig()

	// Configures beat
	pb.Config(b)

	// Run beat. This calls first beater.Setup,
	// then beater.Run and beater.Cleanup in the end
	b.Run()
}
Пример #2
0
func main() {

	// Create Beater object
	fb := &filebeat.Filebeat{}

	// Initi beat objectefile
	b := beat.NewBeat(Name, Version, fb)

	// Additional command line args are used to overwrite config options
	b.CommandLineSetup()

	// Loads base config
	b.LoadConfig()

	// Configures beat
	err := fb.Config(b)
	if err != nil {
		logp.Critical("Config error: %v", err)
		os.Exit(1)
	}

	// Run beat. This calls first beater.Setup,
	// then beater.Run and beater.Cleanup in the end
	b.Run()

}
Пример #3
0
func main() {
	pingbeat := &Pingbeat{}
	b := beat.NewBeat(Name, Version, pingbeat)
	b.CommandLineSetup()
	b.LoadConfig()
	pingbeat.Config(b)
	b.Run()
}
Пример #4
0
func main() {
	mb := &Amqpbeat{}
	b := beat.NewBeat("amqpbeat", "0.1", mb)
	b.CommandLineSetup()
	b.LoadConfig()
	mb.Config(b)
	b.Run()
}
Пример #5
0
// Main file is only used for testing.
func main() {

	mock := &Mockbeat{}
	b := beat.NewBeat(Name, Version, mock)
	b.CommandLineSetup()
	b.LoadConfig()
	mock.Config(b)
	b.Run()
}
Пример #6
0
func main() {
	interval, err := strconv.Atoi(os.Args[2])
	if err != nil {
		log.Fatal(err)
	}

	hb := &hsbeat.HSBeat{os.Args[1], time.Duration(interval), "", false}
	b := beat.NewBeat("hsbeat", "0.1.0", hb)
	b.CommandLineSetup()
	b.LoadConfig()
	b.Run()
}
Пример #7
0
func main() {
	ub := &Uwsgibeat{}

	b := beat.NewBeat(Name, Version, ub)

	b.CommandLineSetup()

	b.LoadConfig()
	ub.Config(b)

	b.Run()
}
Пример #8
0
func main() {

	tb := &Dockerbeat{}

	b := beat.NewBeat(Name, Version, tb)

	b.CommandLineSetup()

	b.LoadConfig()
	tb.Config(b)

	b.Run()

}
Пример #9
0
func main() {
	gb := &Gzipbeat{}

	b := beat.NewBeat(Name, Version, gb)

	b.CommandLineSetup()

	b.LoadConfig()
	err := gb.Config(b)
	if err != nil {
		logp.Critical("Config error: %v", err)
		os.Exit(1)
	}

	b.Run()
}
Пример #10
0
func helpBuildBeat(cfgFile string) (*AmqpBeat, *beat.Beat, error) {
	rb := new(AmqpBeat)
	b := beat.NewBeat("", "", rb)
	b.Events = &MockClient{beat: rb,
		eventsPublished: func(event []common.MapStr, beat *AmqpBeat) {
		},
	}
	err := rb.ConfigWithFile(b, cfgFile)
	if err != nil {
		panic(err)
	}
	err = rb.Setup(b)
	if err != nil {
		panic(err)
	}
	return rb, b, nil
}
Пример #11
0
func main() {
	ab := &beat.AmqpBeat{}

	b := libbeat.NewBeat(name, version, ab)

	b.CommandLineSetup()

	b.LoadConfig()

	err := ab.Config(b)

	if err != nil {
		logp.Critical("Cannot start due to configuration error: %v", err)
		os.Exit(1)
	}

	b.Run()

}
Пример #12
0
func newBeat(cfgFile string, client *MockClient) (*Amqpbeat, *beat.Beat) {
	wd, err := os.Getwd()
	utils.FailOnError(err, "Could not determine working directory")

	ab := &Amqpbeat{}
	b := beat.NewBeat("amqpbeat", "0.0.0", ab)
	ab.ConfigWithFile(b, fmt.Sprintf("%s/../test/config/%s", wd, cfgFile))

	if client == nil {
		client = &MockClient{
			eventsPublished: func(event []common.MapStr, beat *Amqpbeat) {
			},
		}
	}

	client.beat = ab
	b.Events = client
	ab.Setup(b)

	return ab, b
}
Пример #13
0
func main() {
	interval, err := strconv.Atoi(os.Args[2])
	if err != nil {
		log.Fatal(err)
	}

	/*
	   prof, err := os.Create("hsbeat.prof")
	   if err != nil {
	     log.Fatal(err)
	   }
	   pprof.StartCPUProfile(prof)
	   defer pprof.StopCPUProfile()
	*/

	hb := &hsbeat.HSBeat{os.Args[1], time.Duration(interval), "", false}
	b := beat.NewBeat("hsbeat", "0.1.0", hb)
	b.CommandLineSetup()
	b.LoadConfig()
	b.Run()
}