diff --git a/config/configsanity.go b/config/configsanity.go index e69f430df..50fb276a2 100644 --- a/config/configsanity.go +++ b/config/configsanity.go @@ -27,6 +27,7 @@ import ( "strings" "github.com/cgrates/cgrates/utils" + "github.com/cgrates/cron" "github.com/cgrates/rpcclient" ) @@ -914,6 +915,16 @@ func (cfg *CGRConfig) checkConfigSanity() error { return fmt.Errorf("<%s> unsupported data type: %s for exporter with ID: %s", utils.EEs, exp.Type, exp.ID) } + if exp.MetricsResetSchedule != "" { + parser := cron.NewParser( + cron.Minute | cron.Hour | cron.Dom | cron.Month | cron.Dow | cron.Descriptor, + ) + if _, err := parser.Parse(exp.MetricsResetSchedule); err != nil { + return fmt.Errorf("<%s> invalid cron expression %q in metrics_reset_schedule for exporter %q: %v", + utils.EEs, exp.MetricsResetSchedule, exp.ID, err) + } + } + switch exp.Type { case utils.MetaFileCSV: for _, dir := range []string{exp.ExportPath} {