From 3b37d20c5c45498a3ca19f2d48a74f68cc7d5103 Mon Sep 17 00:00:00 2001 From: Valentin Kuznetsov Date: Tue, 24 Jun 2025 10:17:37 -0400 Subject: [PATCH] Changes to include couchdb-prometheus-exporter --- docker/couchdb/Dockerfile | 12 +++++++++--- docker/couchdb/monitor.sh | 9 +++++---- 2 files changed, 14 insertions(+), 7 deletions(-) diff --git a/docker/couchdb/Dockerfile b/docker/couchdb/Dockerfile index 6a1ac10d4..68f3562f9 100644 --- a/docker/couchdb/Dockerfile +++ b/docker/couchdb/Dockerfile @@ -1,3 +1,4 @@ +FROM cmssw/filebeat:latest as filebeat FROM couchdb:3.2.2 MAINTAINER Valentin Kuznetsov vkuznet@gmail.com @@ -24,9 +25,10 @@ RUN mkdir -p $WDIR WORKDIR ${WDIR} # get binary build of couchdb exporter -RUN curl -ksLO https://github.com/gesellix/couchdb-prometheus-exporter/releases/download/v27.0.0/couchdb-prometheus-exporter_27.0.0_Linux_x86_64.tar.gz -RUN tar xfz couchdb-prometheus-exporter_27.0.0_Linux_x86_64.tar.gz -RUN rm couchdb-prometheus-exporter_27.0.0_Linux_x86_64.tar.gz LICENSE README*.md +ARG VER=30.14.0 +RUN curl -ksLO https://github.com/gesellix/couchdb-prometheus-exporter/releases/download/v${VER}/couchdb-prometheus-exporter_${VER}_Linux_x86_64.tar.gz +RUN tar xfz couchdb-prometheus-exporter_${VER}_Linux_x86_64.tar.gz +RUN rm couchdb-prometheus-exporter_${VER}_Linux_x86_64.tar.gz LICENSE README*.md ENV PATH="${WDIR}:${PATH}" # add necessary scripts @@ -47,6 +49,10 @@ ADD manage /data/srv/current/config/couchdb/manage ENV PATH="/opt/couchdb/bin:/usr/local/bin/:${PATH}" +# copy exporters +COPY --from=filebeat /usr/share/filebeat /usr/share/filebeat +COPY --from=filebeat /usr/bin/filebeat /usr/bin/filebeat + # setup final environment USER $USER WORKDIR $WDIR diff --git a/docker/couchdb/monitor.sh b/docker/couchdb/monitor.sh index d9023eb7b..911ec3d59 100755 --- a/docker/couchdb/monitor.sh +++ b/docker/couchdb/monitor.sh @@ -4,10 +4,9 @@ COUCH_CONFIG=/data/srv/current/auth/couchdb/couchdb_config.ini # test if file is not zero size if [ -s "${COUCH_CONFIG}" ]; then - sudo cp /etc/secrets/$fname /data/srv/current/auth/$srv/$fname - sudo chown $USER.$USER /data/srv/current/auth/$srv/$fname - nohup couchdb-prometheus-exporter -telemetry.address=":9984" -logtostderr=true \ - --config=$COUCH_CONFIG -databases.views=false 2>&1 1>& couchdb_exporter.log < /dev/null & + nohup /data/couchdb-prometheus-exporter -telemetry.address=":9984" \ + --config=$COUCH_CONFIG -databases.views=false --databases=_all_dbs 2>&1 1>& \ + /data/couchdb_exporter.log < /dev/null & else echo "ERROR: couchdb_config.ini file is empty and prometheus exporter cannot be started!" fi @@ -19,4 +18,6 @@ if [ -f /etc/secrets/filebeat.yaml ] && [ -f /usr/bin/filebeat ]; then nohup /usr/bin/filebeat \ -c /etc/secrets/filebeat.yaml \ --path.data $ldir/data --path.logs $ldir -e 2>&1 1>& $ldir/log < /dev/null & +else + echo "ERROR: filebeat process is not started as /etc/secrets/filebeat.yaml does not exist" fi