Skip to content

Commit

Permalink
feat: deprecate node_buffer_size_bytes and introduce logging_node_age…
Browse files Browse the repository at this point in the history
…nt_buffer_size_bytes

Signed-off-by: Zadkiel Aharonian <[email protected]>
  • Loading branch information
aslafy-z committed Aug 3, 2023
1 parent e142f5b commit 5867733
Showing 1 changed file with 7 additions and 0 deletions.
7 changes: 7 additions & 0 deletions buffer-size.sh
Original file line number Diff line number Diff line change
Expand Up @@ -3,10 +3,17 @@
[ -z "$BUFFER_PATH" ] && BUFFER_PATH=/buffers

while true; do
# Deprecated: node_buffer_size_bytes will soon be replaced by logging_node_agent_buffer_size_bytes
# logging_node_agent_buffer_size_bytes adds the host label and reduce cardinality by keeping only the top dir values
echo "# HELP node_buffer_size_bytes Disk space used" > /prometheus/node_exporter/textfile_collector/buffer_size.prom
echo "# TYPE node_buffer_size_bytes gauge" >> /prometheus/node_exporter/textfile_collector/buffer_size.prom
du -ab ${BUFFER_PATH} | sed -ne 's/\\/\\\\/;s/"/\\"/g;s/^\([0-9]\+\)\t\(.*\)$/node_buffer_size_bytes{entity="\2"} \1/p' >> /prometheus/node_exporter/textfile_collector/buffer_size.prom.$$
mv /prometheus/node_exporter/textfile_collector/buffer_size.prom.$$ /prometheus/node_exporter/textfile_collector/buffer_size.prom

echo "# HELP logging_node_agent_buffer_size_bytes Disk space used" > /prometheus/node_exporter/textfile_collector/logging_node_agent_buffer_size_bytes.prom
echo "# TYPE logging_node_agent_buffer_size_bytes gauge" >> /prometheus/node_exporter/textfile_collector/logging_node_agent_buffer_size_bytes.prom
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

sleep 60
done

0 comments on commit 5867733

Please sign in to comment.