예제 #1
0
func (e Check) Fetch() []common.MapStr {
	check := check.NagiosCheck{}
	check.Setup(Config)
	events, err := check.Check()
	if err != nil {
		logp.Err("Error On Command: %q: %v", Config.Name, err)
	}
	return events
}
예제 #2
0
func (nagiosCheckBeat *NagiosCheckBeat) Run(b *beat.Beat) error {

	for _, checkConfig := range nagiosCheckBeat.checks {

		checkInstance := check.NagiosCheck{}
		checkInstance.Setup(&checkConfig)
		go checkInstance.Run(func(events []common.MapStr) {
			b.Events.PublishEvents(events)
		})

	}

	for {

		select {
		case <-nagiosCheckBeat.done:
			return nil
		}
	}

	return nil
}