示例#1
0
func newConfigExecutorForTest(t *testing.T) resourced_config.Config {
	config := resourced_config.Config{}
	config.GoStruct = "Shell"
	config.Kind = "executor"
	config.Path = "/x/uptime"
	config.GoStructFields = make(map[string]interface{})
	config.GoStructFields["Command"] = "uptime"

	return config
}
示例#2
0
func createConfigForAgentWriterTest(t *testing.T) resourced_config.Config {
	config := resourced_config.Config{}
	config.Path = "/insights/du"
	config.Interval = "3s"
	config.Kind = "writer"
	config.ReaderPaths = []string{"/du"}
	config.GoStruct = "StdOut"
	config.GoStructFields = make(map[string]interface{})
	return config
}
示例#3
0
// commonData gathers common information for every reader and writer.
func (a *Agent) commonData(config resourced_config.Config) map[string]interface{} {
	record := make(map[string]interface{})
	record["UnixNano"] = time.Now().UnixNano()
	record["Path"] = config.Path

	if config.Interval == "" {
		config.Interval = "1m"
	}
	record["Interval"] = config.Interval

	if config.GoStruct != "" {
		record["GoStruct"] = config.GoStruct
	}

	return record
}