mirror of
https://github.com/prometheus/mysqld_exporter.git
synced 2025-04-18 09:24:02 +03:00
Add multi-target exporter scrape support. Breaking change: `DATA_SOURCE_NAME` is now removed. Local configuration is now supplied by `MYSQLD_EXPORTER_PASSWORD` and command line arguments. Signed-off-by: Mattias Ängehov <mattias.angehov@castoredc.com>
37 lines
667 B
Bash
Executable File
37 lines
667 B
Bash
Executable File
#!/bin/bash
|
|
set -exo pipefail
|
|
|
|
docker_image=$1
|
|
port=$2
|
|
|
|
container_id=''
|
|
|
|
wait_start() {
|
|
for in in {1..10}; do
|
|
if /usr/bin/curl -s -m 5 -f "http://localhost:${port}/metrics" > /dev/null; then
|
|
docker_cleanup
|
|
exit 0
|
|
else
|
|
sleep 1
|
|
fi
|
|
done
|
|
|
|
exit 1
|
|
}
|
|
|
|
docker_start() {
|
|
container_id=$(docker run -d --network mysql-test -p "${port}":"${port}" "${docker_image}" --config.my-cnf=test_exporter.cnf)
|
|
}
|
|
|
|
docker_cleanup() {
|
|
docker kill "${container_id}"
|
|
}
|
|
|
|
if [[ "$#" -ne 2 ]] ; then
|
|
echo "Usage: $0 quay.io/prometheus/mysqld-exporter:v0.10.0 9104" >&2
|
|
exit 1
|
|
fi
|
|
|
|
docker_start
|
|
wait_start
|