Get the Native Fabric Metrics for Peer or Orderer

get

/console/admin/api/v1.1/dashboard/statistics/metrics

You can query the Hyperledger Fabric metrics and publish the output to a Prometheus database.

Request

Supported Media Types
Query Parameters
Back to Top

Response

Supported Media Types

200 Response

Operational metrics exported for consumption by Prometheus.

400 Response

The specified nodeId is invalid.
Body ()
Root Schema : schema
Type: object
Show Source
Example:
{
    "respMesg":"invalid nodeId:peer100"
}

Default Response

unexpected error
Body ()
Root Schema : errorModel
Type: object
Show Source
Back to Top

Examples

New in Hyperledger Fabric 1.4 the RESTful operations service provides a metrics endpoint which allows you to utilize Prometheus to pull operational metrics from peer and orderer nodes. Oracle Blockchain Platform has created a new endpoint to allow you to query these metrics.

Create the Prometheus Database

A typical Prometheus deployment scrapes metrics by requesting them from an HTTP endpoint exposed by instrumented targets. As Prometheus is responsible for requesting the metrics, it is considered a pull system.

Configure a Prometheus database using the following sample configuration:
# my global config
global:
  scrape_interval:     15s # Set the scrape interval to every 15 seconds. Default is every 1 minute.
  evaluation_interval: 15s # Evaluate rules every 15 seconds. The default is every 1 minute.
  # scrape_timeout is set to the global default (10s). 

# Alertmanager configuration
alerting:
  alertmanagers:
  - static_configs:
    - targets:
      # - alertmanager:9093 

# Load rules once and periodically evaluate them according to the global 'evaluation_interval'.
rule_files:
  # - "first_rules.yml"
  # - "second_rules.yml" 

# A scrape configuration containing exactly one endpoint to scrape:
# Here it's Prometheus itself.
scrape_configs:
  # The job name is added as a label `job=<job_name>` to any timeseries scraped from this config.
  - job_name: 'prometheus'
  metrics_path: '/console/admin/api/v1.1/dashboard/statistics/metrics'
  params:
        nodeId:['peer0']
    scheme: 'https'
    tls_config:
        insecure_skip_verify: true
    static_configs:
       - targets: ['hostname.com:10001']

Call the REST API to Query the Hyperledger Fabric Metrics

Use the following REST API to query the Hyperledger Fabric metrics.
  • method: GET
  • path: /console/admin/api/v1.1/dashboard/statistics/metrics
  • query parameters: nodeID(required): The node ID of the peer or orderer to be queried.
For example, to call the API with cURL:
curl -X GET "https://<rest_server_url:port>/console/admin/api/v1.1/dashboard/statistics/metrics?nodeId=peer0" 
    -H "accept:application/json"
Back to Top