openconfig / gnmic

gNMIc is a gNMI CLI client and collector
https://gnmic.openconfig.net
Apache License 2.0
168 stars 54 forks source link

My Prometheus is unable to scrape any telemetry data from gnmic for BGP operational state although gnmic is collecting data from the target and exposing it on port 9273. #404

Closed arbabali999 closed 4 months ago

arbabali999 commented 4 months ago

PFB prometheus.yml and gnmic.yml. My Prometheus is unable to scrape any telemetry data from gnmic for BGP operational state although gnmic is collecting data from the target and exposing it on port 9273.

prometheus.yml:

scrape_configs:

job_name: "Prometheus" static_configs: targets: ["localhost:9090"]

job_name: "gnmic" static_configs: targets: ["localhost:9273"]

job_name: "Grafana" static_configs: targets: ["localhost:3000"]

gnmic.yml:

port: 57400 timeout: 10s insecure: true

targets: 192.168.69.38: username: admin password: admin123 subscriptions:

subscriptions: sros_cpu: paths:

sros_memory_pool: paths:

sros_port_stats: paths:

sros_ce_port_stats: paths:

sros_bgp_state: paths:

outputs: prom: type: prometheus listen: :9273 path: /metrics metric-prefix: gnmic append-subscription-name: true export-timestamps: true debug: false event-processors:

processors: GNU nano 6.2 trim-prefixes: event-strings: value-names:

esa-health: event-strings: value-names:

I have verified using below command (providing one as reference) about subscription path provided in gnmic.yml that subscriptions are correct.

[ { "source": "192.168.69.38:57400", "timestamp": 1711626595652121572, "time": "2024-03-28T16:49:55.652121572+05:00", "updates": [ { "Path": "state/router[router-name=Base]/bgp/neighbor[ip-address=192.168.100.1]/statistics/session-state", "values": { "state/router/bgp/neighbor/statistics/session-state": "Established" } } ] } ]

But http://localhost:9273/metrics doesn't show anything related to BGP operational state although other metrics are reflecting.

Need assistance.

karimra commented 4 months ago

Prometheus accepts float values only, the BGP operational state is a string (Established). In order to show it in Prometheus you have to map it to a number (just like you did with the esa-health processor)

arbabali999 commented 4 months ago

That worked. Thanks.