File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -165,4 +165,7 @@ cython_debug/
165165predefine_user.json
166166src /assets /predefine_user.json
167167
168- influxdb_data
168+ influxdb_data
169+ prometheus_config
170+ * .yml
171+ prometheus_config /prometheus.yml
Load Diff This file was deleted.
Original file line number Diff line number Diff line change @@ -28,5 +28,5 @@ speedtest-cli==2.1.3
2828# prometheus client for monitoring
2929prometheus_client == 0.20.0
3030
31- # influxdb-client==1.46.0
32- influxdb-client == 1.46.0
31+ # influxdb-client, optional for writing metrics to InfluxDB
32+ # influxdb-client==1.46.0
Original file line number Diff line number Diff line change 1+ #! /bin/bash
2+
3+ # Configuration
4+ CONTAINER_NAME=" prometheus"
5+ PROMETHEUS_CONFIG=" $( pwd) /prometheus.yml"
6+ PROMETHEUS_IMAGE=" prom/prometheus" # Add your image name if needed
7+ NETWORK_NAME=" flask-prometheus-net" # Specify your network name
8+ PROMETHEUS_PORT=" 9090" # Specify your port
9+
10+ # Logging function for better readability
11+ log () {
12+ echo " [INFO] $1 "
13+ }
14+
15+ # Check if Prometheus container is running
16+ if [ " $( docker ps -q -f name=" $CONTAINER_NAME " ) " ]; then
17+ log " Stopping container: $CONTAINER_NAME "
18+ docker stop " $CONTAINER_NAME "
19+
20+ log " Starting container: $CONTAINER_NAME with new configuration"
21+ docker start " $CONTAINER_NAME "
22+
23+ log " Reloading configuration for container: $CONTAINER_NAME "
24+ docker exec " $CONTAINER_NAME " kill -HUP 1 # Send SIGHUP to reload config
25+ else
26+ log " Container $CONTAINER_NAME is not running. Starting a new container."
27+ docker run -d \
28+ --name " $CONTAINER_NAME " \
29+ --network " $NETWORK_NAME " \
30+ -p " $PROMETHEUS_PORT :$PROMETHEUS_PORT " \
31+ --restart unless-stopped \
32+ -v " $PROMETHEUS_CONFIG :/etc/prometheus/prometheus.yml" \
33+ " $PROMETHEUS_IMAGE " & > /dev/null
34+
35+ log " Prometheus container started successfully."
36+ fi
37+
38+ log " Prometheus container has been updated with the new configuration."
You can’t perform that action at this time.
0 commit comments