github.com/prysmaticlabs/prysm@v1.4.4/shared/prometheus/README.md (about)

     1  # How to monitor with prometheus
     2  
     3  ## Prerequisites:
     4   - [Prometheus](https://prometheus.io/docs/prometheus/latest/getting_started/) (Instal to scrap metrics and start to monitor)
     5   - (optional) [Grafana](https://grafana.com/grafana/download) (For better graphs)
     6   - (optional) [Setup prometheus+grafana](https://prometheus.io/docs/visualization/grafana/)
     7  
     8  ## Start scrapping services
     9  To start scrapping with prometheus you must create or edit the prometheus config file and add all the services you want to scrap, like these:
    10  
    11  ```diff
    12  global:
    13    scrape_interval:     15s # By default, scrape targets every 15 seconds.
    14  
    15    # Attach these labels to any time series or alerts when communicating with
    16    # external systems (federation, remote storage, Alertmanager).
    17    external_labels:
    18      monitor: 'codelab-monitor'
    19  
    20  # A scrape configuration containing exactly one endpoint to scrape:
    21  # Here it's Prometheus itself.
    22  scrape_configs:
    23    # The job name is added as a label `job=<job_name>` to any timeseries scraped from this config.
    24    - job_name: 'prometheus'
    25  
    26      # Override the global default and scrape targets from this job every 5 seconds.
    27      scrape_interval: 5s
    28  
    29      static_configs:
    30        - targets: ['localhost:9090']
    31  +  - job_name: 'beacon-chain'
    32  +    static_configs:
    33  +      - targets: ['localhost:8080']
    34  ```
    35  
    36  After creating/updating the prometheus file run it:
    37  ```sh
    38  $ prometheus --config.file=your-prometheus-file.yml
    39  ```
    40  
    41  Now, you can add the prometheus server as a data source on grafana and start building your dashboards.
    42  
    43  ## How to add additional metrics
    44  
    45  The prometheus service export the metrics from the `DefaultRegisterer` so just need to register your metrics with the `prometheus` or `promauto` libraries.
    46  To know more [Go application guide](https://prometheus.io/docs/guides/go-application/)