diff --git a/config/config.go b/config/config.go index b0a564e..21ddfde 100644 --- a/config/config.go +++ b/config/config.go @@ -82,9 +82,6 @@ func WriteFile(filename string, content []byte) error { } func (mm MetricsConfig) validate() error { - if len(mm.Metrics) == 0 { - return errors.New("missing field 'metrics' in top configuration") - } for i, m := range mm.Metrics { if m.Name == "" { return errors.New("missing field 'name' in 'metrics' configuration of metric " + fmt.Sprint(i)) diff --git a/examples/opcua.yaml b/examples/opcua.yaml new file mode 100644 index 0000000..172ad4c --- /dev/null +++ b/examples/opcua.yaml @@ -0,0 +1,13 @@ +metrics: + - name: Temperature # MANDATORY + help: get metrics for machine temperature # MANDATORY + nodeid: ns=2;i=10853 # MANDATORY and UNIQUE for each metric + labels: # if metrics share the same name they can be distinguis by labels + site: MLK + type: gauge # MANDATORY metric type can be counter, gauge, Float, Double + - name: Temperature + help: get metrics for machine temperature + nodeid: ns=2;i=10852 + labels: + site: Paris + type: gauge diff --git a/opcua.yaml b/opcua.yaml index 364bc0a..2490f8f 100644 --- a/opcua.yaml +++ b/opcua.yaml @@ -1,13 +1 @@ -metrics: - - name: Temperature # MANDATORY - help: get metrics for machine temperature # MANDATORY - nodeid: ns=2;i=10853 # MANDATORY and UNIQUE for each metric - labels: # if metrics share the same name they can be distinguis by labels - site: MLK - type: gauge # MANDATORY metric type can be counter, gauge, Float, Double - - name: Temperature - help: get metrics for machine temperature - nodeid: ns=2;i=10852 - labels: - site: Paris - type: gauge +metrics: []