How to move labels from gNMI into its own metric

Hi All,
I have the following Telegraf config file (device is a Cisco 9300):

[[inputs.gnmi]]
    addresses = ["x.x.x.x:y"]
    username = "${GNMI_USERNAME}"
    password = "${GNMI_PASSWORD}"
    ## redial in case of failures after
    redial = "10s"
    encoding = "proto"
    [inputs.gnmi.tags]
      device = "support"
    [[inputs.gnmi.subscription]]
        name = "interface_state"
        origin = "openconfig"
        path = "interfaces/interface"
        subscription_mode = "sample"
        sample_interval = "30s"

[[outputs.prometheus_client]]
  listen = ":9011"

Which is resulting in correct metrics for the interface overall however I would like to also store the oper_state of the interface, however this gets stored as a label for each entry. Is there a way I can get Telegraf to separate the interface state for each interface, I tried using the interfaces/interface/state endpoint however it would still store the state as a label.

Any guidance would be great, maybe a processor of some form could be used i’m not sure?
Thanks!

Answered my own question, it’s because strings won’t be made into metrics, so i used enum to convert them into integer values

2 Likes

@ewsclass66 thank you for sharing your answer with the community!