Esempio n. 1
0
func main() {
	filename := flag.String("conf", "/etc/skydive/skydive.ini",
		"Config file with all the skydive parameter.")
	flag.CommandLine.Usage = usage
	flag.Parse()

	err := config.InitConfigFromFile(*filename)
	if err != nil {
		fmt.Fprintf(os.Stderr, "%v\n", err)
		os.Exit(1)
	}

	logging.GetLogger().Notice("Skydive Agent starting...")
	agent := agent.NewAgent()
	agent.Start()

	ch := make(chan os.Signal)
	signal.Notify(ch, syscall.SIGINT, syscall.SIGTERM)
	<-ch

	agent.Stop()

	logging.GetLogger().Notice("Skydive Agent stopped.")
}
Esempio n. 2
0
func StartAgent(t *testing.T) *agent.Agent {
	agent := agent.NewAgent()
	go agent.Start()
	return agent
}
Esempio n. 3
0
func StartAgent() *agent.Agent {
	agent := NewAgent()
	agent.Start()
	return agent
}
Esempio n. 4
0
	"github.com/redhat-cip/skydive/agent"
	"github.com/redhat-cip/skydive/config"
	"github.com/redhat-cip/skydive/logging"

	"github.com/spf13/cobra"
)

var Agent = &cobra.Command{
	Use:          "agent",
	Short:        "Skydive agent",
	Long:         "Skydive agent",
	SilenceUsage: true,
	Run: func(cmd *cobra.Command, args []string) {
		logging.GetLogger().Notice("Skydive Agent starting...")
		agent := agent.NewAgent()
		agent.Start()

		ch := make(chan os.Signal)
		signal.Notify(ch, syscall.SIGINT, syscall.SIGTERM)
		<-ch

		agent.Stop()

		logging.GetLogger().Notice("Skydive Agent stopped.")
	},
}

func init() {
	Agent.Flags().String("listen", "127.0.0.1:8081", "address and port for the agent API")
	config.GetConfig().BindPFlag("agent.listen", Agent.Flags().Lookup("listen"))
Esempio n. 5
0
func StartAgent() *agent.Agent {
	agent := agent.NewAgent()
	go agent.Start()
	return agent
}
Esempio n. 6
0
func StartAgentWithConfig(t *testing.T, conf string, params ...HelperParams) *agent.Agent {
	InitConfig(t, conf, params...)
	agent := NewAgent()
	agent.Start()
	return agent
}