Exemple #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.")
}
Exemple #2
0
func StartAgent(t *testing.T) *agent.Agent {
	agent := agent.NewAgent()
	go agent.Start()
	return agent
}
Exemple #3
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"))
Exemple #4
0
func NewAgent() *agent.Agent {
	return agent.NewAgent()
}
Exemple #5
0
func StartAgent() *agent.Agent {
	agent := agent.NewAgent()
	go agent.Start()
	return agent
}