diff --git a/mqtt2prom/Dockerfile b/mqtt2prom/Dockerfile index 44900e1..f8964e9 100644 --- a/mqtt2prom/Dockerfile +++ b/mqtt2prom/Dockerfile @@ -1,4 +1,4 @@ -FROM debian:12 as prepare +FROM debian:12 RUN apt-get update && apt-get upgrade -y RUN apt-get install -y php-dev php-cli php-pear php-mbstring php-curl git build-essential libmosquitto-dev libmosquitto-dev php-sqlite3 WORKDIR /tmp @@ -11,12 +11,4 @@ RUN make install RUN echo "extension=mosquitto.so" > /etc/php/8.2/cli/php.ini ADD run /usr/local/bin/entrypoint RUN chmod +x /usr/local/bin/entrypoint -FROM prepare as make_git_id -WORKDIR /tmp/repo -ADD .git /tmp/repo/.git -RUN git rev-parse HEAD > /tmp/git_id -FROM prepare as runner -ENV GIT_ID=unknown -COPY --from=make_git_id /tmp/git_id /var/lib/git_id - CMD ["/usr/local/bin/entrypoint"] diff --git a/mqtt2prom/run b/mqtt2prom/run index 8f61d95..1d479e8 100755 --- a/mqtt2prom/run +++ b/mqtt2prom/run @@ -14,16 +14,13 @@ pcntl_signal(SIGTERM, "endit"); pcntl_signal(SIGHUP, "endit"); $mqttPort = getEnvWithDefaultInt("MQTT_PORT", 1883); + $mqttUser = getEnvWithDefaultStr("MQTT_USER", ""); $mqttPass = getEnvWithDefaultStr("MQTT_PASS", ""); $mqttClientId = getEnvWithDefaultStr("MQTT_CLIENT_ID", "mqtt2prometheus"); $mqttTopic = getEnvWithDefaultStr("MQTT_TOPIC", "prometheus"); $qos = getEnvWithDefaultInt("MQTT_QOS", 2); $ignoreRetained = getEnvWithDefaultInt("IGNORE_RETAINED", 1) ? 1 : 0; -$gitId="Unknown"; -if (is_file("/var/lib/git_id")) { - $gitId = trim(file_get_contents("/var/lib/git_id")); -} $mqtt = new Mosquitto\Client($mqttClientId); @@ -188,11 +185,10 @@ function precheck(Message $message): bool function output(): void { filter(); - global $data, $stats, $globalCounter,$gitId; + global $data, $stats, $globalCounter; $t = time(); $prom = ""; - $prom .= "# from git-id : $gitId\n"; $prom .= "# service started at : " . STARTED .