27 lines
907 B
Bash
Executable File
27 lines
907 B
Bash
Executable File
#!/bin/bash
|
|
set -euo pipefail
|
|
|
|
echo "[INFO] Starting Prometheus under supervisor..."
|
|
|
|
PROMETHEUS_BASE_PATH=${PROMETHEUS_BASE_PATH:-/private/argus/metric/prometheus}
|
|
DOMAIN=prom.metric.argus.com
|
|
|
|
echo "[INFO] Prometheus base path: ${PROMETHEUS_BASE_PATH}"
|
|
|
|
# 生成配置文件
|
|
echo "[INFO] Generating prometheus.yml with base path: ${PROMETHEUS_BASE_PATH}"
|
|
sed "s|\${PROMETHEUS_BASE_PATH}|${PROMETHEUS_BASE_PATH}|g" \
|
|
/etc/prometheus/prometheus.yml > ${PROMETHEUS_BASE_PATH}/prometheus.yml
|
|
|
|
# 记录容器 IP
|
|
IP=$(ifconfig eth0 | awk '/inet /{print $2}')
|
|
echo "current IP: ${IP}"
|
|
echo "${IP}" > /private/argus/etc/${DOMAIN}
|
|
|
|
exec /bin/prometheus \
|
|
--config.file=${PROMETHEUS_BASE_PATH}/prometheus.yml \
|
|
--storage.tsdb.path=/prometheus \
|
|
--web.enable-lifecycle \
|
|
--web.console.libraries=/usr/share/prometheus/console_libraries \
|
|
--web.console.templates=/usr/share/prometheus/consoles
|