From 149a9f44c7294a36348b8dea35ab8dffc3f7e4f0 Mon Sep 17 00:00:00 2001 From: Zadkiel Aharonian Date: Thu, 3 Aug 2023 14:59:57 +0000 Subject: [PATCH] feat: introduce logging_node_agent_buffer_size_bytes that tracks file count Signed-off-by: Zadkiel Aharonian --- buffer-size.sh | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/buffer-size.sh b/buffer-size.sh index 0aceb14..a42d33a 100644 --- a/buffer-size.sh +++ b/buffer-size.sh @@ -15,5 +15,10 @@ while true; do du -sb ${BUFFER_PATH} | sed -ne 's/\\/\\\\/;s/"/\\"/g;s/^\([0-9]\+\)\t\(.*\)$/logging_node_agent_buffer_size_bytes{entity="\2", host="'$(hostname)'"} \1/p' >> /prometheus/node_exporter/textfile_collector/logging_node_agent_buffer_size_bytes.prom.$$ mv /prometheus/node_exporter/textfile_collector/logging_node_agent_buffer_size_bytes.prom.$$ /prometheus/node_exporter/textfile_collector/logging_node_agent_buffer_size_bytes.prom + echo "# HELP logging_node_agent_buffer_files File count" > /prometheus/node_exporter/textfile_collector/logging_node_agent_buffer_files.prom + echo "# TYPE logging_node_agent_buffer_files gauge" >> /prometheus/node_exporter/textfile_collector/logging_node_agent_buffer_files.prom + echo -e "$(find "${BUFFER_PATH}" -type f 2>/dev/null | wc -l)\t${BUFFER_PATH}" | sed -ne 's/\\/\\\\/;s/"/\\"/g;s/^\([0-9]\+\)\t\(.*\)$/logging_node_agent_buffer_files{entity="\2", host="'$(hostname)'"} \1/p' >> /prometheus/node_exporter/textfile_collector/logging_node_agent_buffer_files.prom.$$ + mv /prometheus/node_exporter/textfile_collector/logging_node_agent_buffer_files.prom.$$ /prometheus/node_exporter/textfile_collector/logging_node_agent_buffer_files.prom + sleep 60 done