Skip to content


gnmic supports exposing gnmi updates on a prometheus server, for a prometheus client to scrape.

A Prometheus output can be defined using the below format in gnmic config file under outputs section:

    type: prometheus # required
    listen: :9804 # address to listen on for incoming scape requests
    path: /metrics # path to query to get the metrics
    expiration: 60s # maximum lifetime of metrics in the local cache
    debug: false # enable debug for prometheus output

gnmic creates the prometheus metric name and its labels from the subscription name, the gnmic path and the value name.

Metric Generation#

The below diagram shows an example of a prometheus metric generation from a gnmi update

Metric Naming#

The metric name starts with the string gnmic then the subscription name as specified in gnmic configuraiton file, followed by the gNMI path stripped from its keys if there are any.

All non-alphanumeric characters are replaced with an underscore "_"

The 3 strings are then joined with an underscore "_"

For example, a gNMI update from subscription port-stats with path:


is exposed as a metric named:


Metric Labels#

The metrics labels are generated from the subscripion metadata (e.g: subscription-name and source) and the keys present in the gNMI path elements.

For the previous example the labels would be: