Exemple #1
0
	"syscall"

	"github.com/skydive-project/skydive/analyzer"
	"github.com/skydive-project/skydive/config"
	"github.com/skydive-project/skydive/logging"

	"github.com/spf13/cobra"
)

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

		server, err := analyzer.NewServerFromConfig()
		if err != nil {
			logging.GetLogger().Fatalf("Can't start Analyzer : %v", err)
		}

		server.ListenAndServe()

		logging.GetLogger().Notice("Skydive Analyzer started !")
		ch := make(chan os.Signal)
		signal.Notify(ch, syscall.SIGINT, syscall.SIGTERM)
		<-ch

		server.Stop()
Exemple #2
0
	"syscall"

	"github.com/skydive-project/skydive/agent"
	"github.com/skydive-project/skydive/config"
	"github.com/skydive-project/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.SetLoggingID("agent")
		logging.GetLogger().Notice("Skydive Agent starting...")
		agent := agent.NewAgent()
		agent.Start()

		logging.GetLogger().Notice("Skydive Agent started")
		ch := make(chan os.Signal)
		signal.Notify(ch, syscall.SIGINT, syscall.SIGTERM)
		<-ch

		agent.Stop()

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