mirror of
https://github.com/cgrates/cgrates.git
synced 2026-02-11 10:06:24 +05:00
add sanity check for metrics_reset_schedule
This commit is contained in:
committed by
Dan Christian Bogos
parent
ef4324fc0e
commit
adadcd01cb
@@ -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} {
|
||||
|
||||
Reference in New Issue
Block a user