How to parse NX-API with telegraf

Hi, I’m doing research on the best telemetry system. Currently, I’m starting from this guide https://chapeter-sbx.readthedocs.io/en/latest/labs/metrics-grafana/ and I would like to replace pipeline with telegraph for more input compatibility. I’ve found this https://ultraconfig.com.au/blog/cisco-telemetry-tutorial-with-telegraf-influxdb-and-grafana/ which uses telegraf but its using the yang encoding in the switches instead of nx-api (as in the first guide).
The question is: how can I parse the data in telegfraf from nx-api format before sending them to influxdb like pipeline which is using metrics.json?
Ps: I’m not an expert and this is all new for me (edited)

Hello @stefanoromanello,
Welcome!
Have you had a chance to take a look at the execd processor plugin?
I think that might be helpful to you.

Hi thanks for the answer! Another user in slack suggests me to use telegraf_gnmi and use it also for parsing the data like this:

[[inputs.cisco_telemetry_gnmi]]
    addresses = ["dallas.create2020.ntc.cloud.tesuto.com:50000"]
    username = <redacted>
    password = <redacted>

    ## redial in case of failures after
    redial = "10s"
    tagexclude = ["openconfig-network-instance:/network-instances/network-instance/protocols/protocol/name"]

    [[inputs.cisco_telemetry_gnmi.subscription]]
        origin = "openconfig-interfaces"
        path = "/interfaces/interface"

        subscription_mode = "sample"
        sample_interval = "10s"

    [[inputs.cisco_telemetry_gnmi.subscription]]
        name = "bgp_neighbor"
        origin = "openconfig-network-instance"
        path = "/network-instances/network-instance/protocols/protocol/bgp/neighbors/neighbor/state"

        subscription_mode = "sample"
        sample_interval = "10s"

Full guide at Monitor Your Network With gNMI, SNMP, and Grafana | The NTC Mag
What do you think?

1 Like

Hello @stefanoromanello,
looks good to me!