From 53ed0acb3db3d1ea1265f86a2d4a78b29473d008 Mon Sep 17 00:00:00 2001 From: berfinsari Date: Tue, 15 Aug 2017 17:42:42 +0300 Subject: [PATCH] Add etcdbeat --- config/config.go | 27 +++++++++++++++++++++++++++ config/config_test.go | 3 +++ main.go | 16 ++++++++++++++++ main_test.go | 22 ++++++++++++++++++++++ 4 files changed, 68 insertions(+) create mode 100644 config/config.go create mode 100644 config/config_test.go create mode 100644 main.go create mode 100644 main_test.go diff --git a/config/config.go b/config/config.go new file mode 100644 index 0000000..0422e7f --- /dev/null +++ b/config/config.go @@ -0,0 +1,27 @@ +// Config is put into a different package to prevent cyclic imports in case +// it is needed in several locations + +package config + +type EtcdbeatConfig struct { + Period *int64 + Port *string + Host *string + + // Authentication for BasicAuth + Authentication struct { + Enable *bool + Username *string + Password *string + } + + Statistics struct { + Leader *bool + Self *bool + Store *bool + } +} + +type ConfigSettings struct { + Input EtcdbeatConfig +} diff --git a/config/config_test.go b/config/config_test.go new file mode 100644 index 0000000..d177de3 --- /dev/null +++ b/config/config_test.go @@ -0,0 +1,3 @@ +// +build !integration + +package config diff --git a/main.go b/main.go new file mode 100644 index 0000000..535079b --- /dev/null +++ b/main.go @@ -0,0 +1,16 @@ +package main + +import ( + "os" + + "github.com/elastic/beats/libbeat/beat" + + "github.com/gamegos/etcdbeat/beater" +) + +func main() { + err := beat.Run("etcdbeat", "", beater.New) + if err != nil { + os.Exit(1) + } +} diff --git a/main_test.go b/main_test.go new file mode 100644 index 0000000..e206e9e --- /dev/null +++ b/main_test.go @@ -0,0 +1,22 @@ +package main + +// This file is mandatory as otherwise the etcdbeat.test binary is not generated correctly. + +import ( + "flag" + "testing" +) + +var systemTest *bool + +func init() { + systemTest = flag.Bool("systemTest", false, "Set to true when running system tests") +} + +// Test started when the test binary is started. Only calls main. +func TestSystem(t *testing.T) { + + if *systemTest { + main() + } +}