Export football match schedules as Prometheus metrics for Iran league. This script will use the https://iranleague.ir site to fetch the match schedules and export them as Prometheus metrics.
/health, /ready)You can run this exporter as a Docker container:
docker run -d -p 8000:8000 \
-e AUTH_USERNAME=admin \
-e AUTH_PASSWORD=1234 \
hatamiarash7/iranleague-exporter:latest
Check the metrics at http://localhost:8000/metrics.
| Endpoint | Auth Required | Description |
|---|---|---|
/metrics | Yes | Prometheus metrics |
/health | No | Health check (liveness probe) |
/ready | No | Readiness check (readiness probe) |
You can configure the exporter using the following environment variables:
| Key | Default | Description |
|---|---|---|
| HTTP_HOST | 0.0.0.0 | Host to bind the HTTP server to |
| HTTP_PORT | 8000 | Port to bind the HTTP server to |
| HTTP_WORKERS | 1 | Number of worker processes |
| LOG_LEVEL | INFO | Log level (DEBUG, INFO, WARNING, ERROR, CRITICAL) |
| Key | Default | Description |
|---|---|---|
| AUTH_USERNAME | Username for basic authentication | |
| AUTH_PASSWORD | Password for basic authentication |
| Key | Default | Description |
|---|---|---|
| CRAWLER_URL | https://iranleague.ir/fa/MatchSchedule/1/1 | URL to fetch match schedules from |
| CRAWLER_CONNECT_TIMEOUT | 5.0 | Connection timeout in seconds |
| CRAWLER_READ_TIMEOUT | 10.0 | Read timeout in seconds |
| CRAWLER_MAX_RETRIES | 3 | Maximum number of retry attempts |
| CRAWLER_RETRY_BACKOFF | 0.5 | Backoff factor for retries |
| CRAWLER_USER_AGENT | IranLeagueExporter/1.0 | User-Agent header for requests |
| Key | Default | Description |
|---|---|---|
| LABEL_LANG | EN | Language for the team names (FA, EN) |
| UPDATE_INTERVAL | 30 | Interval to update the match schedules (in minutes) |
| TZ | Timezone (e.g., Asia/Tehran) |
The exporter provides the following metrics:
| Metric | Type | Description |
|---|---|---|
ir_league_matches | Gauge | Timestamp of upcoming matches |
ir_league_matches_total | Gauge | Total number of future matches found |
ir_league_scrape_duration_seconds | Gauge | Duration of the last scrape in seconds |
ir_league_scrape_success | Gauge | Whether the last scrape was successful |
ir_league_exporter_info | Info | Exporter version and configuration info |
# Install dependencies
make install
# Run locally
make run
# Run tests
make test
# Run tests with coverage
make test-cov
# Lint code
make lint
# Format code
make format
# Type check
make typecheck
Don't be shy and reach out to us if you want to contribute 😉
git checkout -b my-new-featuregit commit -am 'Add some feature'git push origin my-new-featureEach project may have many problems. Contributing to the better development of this project by reporting them. 👍
Content type
Image
Digest
sha256:68d018407…
Size
182.7 MB
Last updated
10 months ago
docker pull hatamiarash7/iranleague-exporter