A simple and lightweight alternative to cAdvisor for getting basic Docker container metrics as well as custom metrics (e.g. container uptime and number of logged messages).
- Compare the increased load with the number of logged messages.
- If the application is not resource-intensive, the number of logged messages will show the increased load.
- Speed up log analysis by displaying at what point in time the most messages were received from the standard and error stream.
- Functions for extracting basic and custom metrics
- Converting metrics to Prometheus format
- HTTP server and logging
- Error handling (check for missing data)
- Getting data in a goroutine
- Grafana Dashboard
- Docker image
- Testing
Build the Docker image yourself (optional):
git clone https://github.com/Lifailon/logporter
cd logporter
docker build -t lifailon/logporter .
# or build for different architectures
docker buildx build --platform linux/amd64,linux/arm64 .
- Run the exporter in a container using an image from Docker Hub:
docker run -d --name logporter \
-v /var/run/docker.sock:/var/run/docker.sock \
-p 9333:9333 \
--restart=unless-stopped \
lifailon/logporter:latest
- Connect the new target in the
prometheus.yml
configuration:
scrape_configs:
- job_name: logporter
scrape_interval: 5s
scrape_timeout: 5s
static_configs:
- targets:
- localhost:9333
- Import the prepared public Grafana Dashboard using the id
23573
or from a json file.
Important
If you notice a bug in PromQL
queries or want to improve the Grafana dashboard, create a new issue or make the changes yourself using a Pull Request.