Skip to content

Latest commit

 

History

History
85 lines (61 loc) · 2.8 KB

README.md

File metadata and controls

85 lines (61 loc) · 2.8 KB

Locust Prometheus Exporter

Compatible with Locust 2.29.1

Docker Pulls

Inspired by ContainerSolutions/locust_exporter and mbolek/locust_exporter

This is a Locust exporter for Prometheus made on Python.

Grafana Screen

Requirements

For the best experience of using this exporter you need to be installed:

  1. Prometheus
  2. Grafana
  3. Python 3.10-3.12
  4. (Optional) Docker

Quick Start

  1. Start Locust (you can use legacy and modern UI, but I prefer Legacy)
  2. Modify prometheus.yml and start Prometheus:
    - job_name: 'locust'
    
    scrape_interval: 2s
    scrape_timeout: 2s
    static_configs:
      - targets: ['<exporter_host>:<exporter_port>']
    
  3. Configure config.json in the root of this project as you need:
    • port – on this port export will start (this port also should be used in prometheus.yml)
    • host – where Locust is up
  4. Run
    python3 LocustExporter.py --config config.json
  5. Use this Grafana Dashboard to watch your Locust.

(Alternative) Quick Start With Docker

Complete the first two steps from the previous section (Quick Start) and then use this: Docker Hub or use Dockerfile in the root of this project.

(Alternative) An Extremely Fast Solution [Docker Compose]

If you don't want to worry about anything you really should try out this way!

First of all, you need docker installed in your system!

When all is ready follow this steps:

  • clone or download this project

  • go to docker dir of the project

    cd docker
  • Using your editor (vim, nano ...) change LOCUST_HOST in locust_exporter block of docker-compose.yml to desired one

    • if your Locust is up on localhost you don't need to edit this file (pass edit step)
  • run docker compose up (first time)

    docker compose up -d

    OR (if U need to rebuild existing containers with new configs)

    docker compose up -d --remove-orphans
  • ENJOY IT ;-)

Used ports

  • 3000/tcp - grafana
  • 9090/tcp - prometheus
  • 9191/tcp - locust_exporter

In order to change them, edit configs!