Running via Python

Tips and Tricks. This is for windows

Things you will need

Infura

set WEB3_INFURA_API_SECRET=
set WEB3_INFRUA_PROJECT_ID=

Prometheus

  • Prometheus

    • Below is the config you can use to feed Yearn-Exporter into prometheus. This has to have exact spacing or it will throw an error.

# 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: 'yearnv2'

    # metrics_path defaults to '/metrics'
    # scheme defaults to 'http'.

    static_configs:
    - targets: ['localhost:8801']
  - job_name: 'yearn'

    # metrics_path defaults to '/metrics'
    # scheme defaults to 'http'.

    static_configs:
    - targets: ['localhost:8800']  
  - job_name: 'prometheus'

    # metrics_path defaults to '/metrics'
    # scheme defaults to 'http'.

    static_configs:
    - targets: ['localhost:9090']

Python

Brownie

  • Check if pip is installed via

C:\> py -m pip --version
pip X.Y.Z from ...\site-packages\pip (python X.Y)

If it is not install pip from here https://pip.pypa.io/en/stable/installing/ then

pip install eth-brownie

Etherscan API key

  • Make an Etherscan account and api key

  • Add ETHERSCAN_TOKEN as a variable in windows under user variables

    • you can either add it manually or alternatively you can run set ETHERSCAN_TOKEN=yourtokenkey in cmd

  • Make its value your Api-Key Token

  • Grafana

    • After installing go to settings > Data Sources > Add Data Source

    • Select Prometheus

      • URL: http://yourIPv4address:9090

      • Access: Browser

      • Save and test! Make sure yearn exporter is running and prometheus is also running. If it is working it will show green.

    • Import pre-made dashboards found here by + (create) > import > upload json file

Last updated