opsdis / aci-exporter

A Cisco ACI Prometheus exporter written in Go
https://www.opsdis.com
GNU General Public License v3.0
47 stars 16 forks source link

value transformation do not work #32

Closed ahmedaall closed 1 year ago

ahmedaall commented 1 year ago

Describe the bug value_transform do not work. It always display 0 as id no matter the value of the operstatus


    class_name: eqptPsu
    metrics:
      - name: infra_node_psu
        value_name: X
        type: "gauge"
        help: "Returns the info of the node psu states"
        unit: "info"
        value_calculation: "1"
    value_transform:
        'unknown':            0
        'ok':                 1
        'fail':               2
        'absent':             3
        'shut':               4
        'mismatch':           5
thenodon commented 1 year ago

Hi @ahmedaall, In the future do not send screenshots, send the real or part of the config file as yaml. The obvious reason it is not working is that your configuration is wrong. value_transform is part of metrics. Please checkout https://github.com/opsdis/aci-exporter/blob/master/example-config.yaml and make sure your indentation is correct. Since you do not do any value_calculation you do not need to specify it. Hope that solves your problem

ahmedaall commented 1 year ago

Hi @thenodon I will take this file as a reference for the futur ! It works now with the good indentation. Thx !

thenodon commented 1 year ago

Great to hear @ahmedaall Just some additional information that can be good to know. In the current implementation of aci-exporter 0 is the default value if a correct float can not be returned. It is visible in the log as a warning.