This commit is contained in:
Zakary Timson 2022-06-02 19:15:59 +00:00
parent 7386ea1274
commit caae472169
2 changed files with 4 additions and 3 deletions

View File

@ -1,6 +1,7 @@
FROM prom/node-exporter:latest
ENV NODE_ID=none
USER root
COPY entrypoint.sh /etc/node-exporter/
ENTRYPOINT ["sh", "/etc/node-exporter/entrypoint.sh"]
ENTRYPOINT ["/etc/node-exporter/entrypoint.sh"]
CMD ["/bin/node_exporter"]

View File

@ -1,6 +1,6 @@
#!/bin/sh
#!/bin/sh -e
NODE_NAME=$(cat "/host/etc/hostname")
echo "node_meta{node_name=\"$NODE_NAME\"} 1" > /etc/node-exporter/node-meta.prom
echo "node_meta{node_id=\"$NODE_ID\", container_label_com_docker_swarm_node_id=\"$NODE_ID\", node_name=\"$NODE_NAME\"} 1" > /etc/node-exporter/node-meta.prom
set -- /bin/node_exporter "$@"
exec "$@"