重新编译gluster_exporter源码,构建镜像
1.github
https://github.com/ofesseler/gluster_exporter
2.dockerfile
FROM golang:1.17 ENV GO111MODULE=on \ GOPROXY="https://goproxy.cn,direct" COPY gluster_exporter-0.2.7 /apps/gluster_exporter-0.2.7 WORKDIR /apps/gluster_exporter-0.2.7 RUN go mod init RUN go mod vendor RUN go build EXPOSE 9189 EXPOSE 24007 EXPOSE 24008 RUN mkdir -p /data RUN mkdir -p /mnt/data RUN mkdir -p /mnt/gv_test RUN cp /apps/gluster_exporter-0.2.7/gluster-init.sh /usr/bin/gluster-init.sh RUN chmod a+x /usr/bin/gluster-init.sh RUN cp /apps/gluster_exporter-0.2.7/gluster_exporter /usr/bin/gluster_exporter WORKDIR /apps/gluster_exporter-0.2.7 ENTRYPOINT sh /usr/bin/gluster-init.sh
3.gluster_exporter好像无法通过配置参数的方式连接到指定的glusterfs节点,所以只能在每一台部署了glusterfs的物理机上部署一个gluster_exporter。
gluster_exporter如果有容器化部署的方式,烦请留言交流一下。