initial commit of bin scripts into git
This commit is contained in:
27
node-collector-disk-stats-export
Executable file
27
node-collector-disk-stats-export
Executable file
@@ -0,0 +1,27 @@
|
||||
#!/bin/bash
|
||||
|
||||
used=`df /export | tail -n1 | awk '{print $3}'`
|
||||
md_dev=`df /export | tail -n1 | awk '{print $1}'`
|
||||
free=`df /export | tail -n1 | awk '{print $4}'`
|
||||
total=`echo "$used + $free" | bc`
|
||||
|
||||
tmp_file=/tmp/directory_size.prom.$$
|
||||
real_file=/srv/docker/container/node-exporter/textfile_collector/directory_size.prom
|
||||
|
||||
echo "# HELP node_filesystem_avail_bytes Filesystem space available to non-root users in bytes." > $tmp_file
|
||||
echo "# TYPE node_filesystem_avail_bytes gauge" >> $tmp_file
|
||||
|
||||
echo "# HELP node_filesystem_size_bytes Filesystem size in bytes." >> $tmp_file
|
||||
echo "# TYPE node_filesystem_size_bytes gauge" >> $tmp_file
|
||||
|
||||
echo "node_filesystem_avail_bytes{device=\"$md_dev\",fstype=\"ext4\",mountpoint=\"/export\"} $free" >> $tmp_file
|
||||
echo "node_filesystem_size_bytes{device=\"$md_dev\",fstype=\"ext4\",mountpoint=\"/export\"} $total" >> $tmp_file
|
||||
|
||||
used=`df / | tail -n1 | awk '{print $3}'`
|
||||
root_dev=`df / | tail -n1 | awk '{print $1}'`
|
||||
free=`df / | tail -n1 | awk '{print $4}'`
|
||||
total=`echo "$used + $free" | bc`
|
||||
|
||||
echo "node_filesystem_avail_bytes{device=\"$root_dev\",fstype=\"ext4\",mountpoint=\"/\"} $free" >> $tmp_file
|
||||
echo "node_filesystem_size_bytes{device=\"$root_dev\",fstype=\"ext4\",mountpoint=\"/\"} $total" >> $tmp_file
|
||||
mv $tmp_file $real_file
|
||||
Reference in New Issue
Block a user