diff --git a/conf/example.input.exec/exec.toml b/conf/input.exec/exec.toml similarity index 73% rename from conf/example.input.exec/exec.toml rename to conf/input.exec/exec.toml index 9cc243f..3acfa4d 100644 --- a/conf/example.input.exec/exec.toml +++ b/conf/input.exec/exec.toml @@ -1,11 +1,11 @@ # # collect interval # interval = 15 -[[instances]] -# commands, support glob -commands = [ - "/opt/categraf/scripts/*.sh" -] +# [[instances]] +# # commands, support glob +# commands = [ +# "/opt/categraf/scripts/*.sh" +# ] # # timeout for each command to complete # timeout = 5 diff --git a/conf/example.input.oracle/metric.toml b/conf/input.oracle/metric.toml similarity index 100% rename from conf/example.input.oracle/metric.toml rename to conf/input.oracle/metric.toml diff --git a/conf/example.input.oracle/oracle.toml b/conf/input.oracle/oracle.toml similarity index 65% rename from conf/example.input.oracle/oracle.toml rename to conf/input.oracle/oracle.toml index d91bf2c..59cb2ce 100644 --- a/conf/example.input.oracle/oracle.toml +++ b/conf/input.oracle/oracle.toml @@ -1,14 +1,14 @@ # # collect interval # interval = 15 -[[instances]] -address = "10.1.2.3:1521/orcl" -username = "monitor" -password = "123456" -is_sys_dba = false -is_sys_oper = false -disable_connection_pool = false -max_open_connections = 5 +# [[instances]] +# address = "10.1.2.3:1521/orcl" +# username = "monitor" +# password = "123456" +# is_sys_dba = false +# is_sys_oper = false +# disable_connection_pool = false +# max_open_connections = 5 # # interval = global.interval * interval_times # interval_times = 1 # labels = { region="cloud" } diff --git a/inputs/exec/exec.go b/inputs/exec/exec.go index ceef54d..8b2bb0e 100644 --- a/inputs/exec/exec.go +++ b/inputs/exec/exec.go @@ -58,6 +58,10 @@ func (e *Exec) GetInterval() config.Duration { } func (e *Exec) Init() error { + if len(e.Instances) == 0 { + return fmt.Errorf("exec instances empty") + } + for i := 0; i < len(e.Instances); i++ { if e.Instances[i].DataFormat == "" || e.Instances[i].DataFormat == "influx" { e.Instances[i].parser = influx.NewSeriesParser() diff --git a/inputs/oracle/oracle.go b/inputs/oracle/oracle.go index 8853d53..ca8e247 100644 --- a/inputs/oracle/oracle.go +++ b/inputs/oracle/oracle.go @@ -76,6 +76,9 @@ func (o *Oracle) Init() error { o.dbconnpool = make(map[string]*sqlx.DB) for i := 0; i < len(o.Instances); i++ { dbConf := o.Instances[i] + if dbConf.Address == "" { + return fmt.Errorf("some oracle address is blank") + } connString := getConnectionString(dbConf) db, err := sqlx.Open("godror", connString) if err != nil {