#!/bin/bash function ConvertToTB () { if awk "BEGIN{exit ($1 > 1000 ? 0 : 1)}" then StorageInTB=$(echo $1 | awk '{printf "%.1f\n", $1 / 1024}') if awk "BEGIN{exit ($StorageInTB > 1000 ? 0 : 1)}" then StorageInTB=$(echo $StorageInTB | awk '{printf "%.1f\n", $1 / 1024}') echo $StorageInTB TB # is technically TiB else StorageInGB=$StorageInTB echo $StorageInGB GB # is technically GiB fi else StorageInGB=$1 echo $StorageInGB MB # is technically MiB fi } function ConvertOnlyToTB () { SpaceInTB=$(echo $1 | awk '{printf "%.1f\n", $1 / 1024}') # is technically TiB echo $SpaceInTB } function GetRepoCapacity () { getRepoValue=$(df -BM --output=$1,target | grep -w -m 1 $2 | sed 's/[[:blank:]]*//' | sed s'/\M.*//'); \ getRepoValue=$(ConvertToTB $getRepoValue) echo $getRepoValue $3; \ } # License number license_number=$(grep -w 'license_number' /etc/filescale/cluster.ansible.yml | grep -o -P '(?<=license_number: ).*(?=)') sender=$(grep -w sender /etc/filescale/cluster.yml | grep -o -P '(?<=sender: ).*(?=)') recipient=$(grep -w recipient /etc/filescale/cluster.yml | grep -o -P '(?<=recipient: ).*(?=)') ( echo "To: ${recipient}" echo "From: ${sender}" echo "Subject: [INFO] ${license_number} - iTernity - iCAS FS - Capacity-Report" echo "Mime-Version: 1.0" echo "Content-Type: text/html; charset='utf-8'" echo "
iTernity iCAS FS Capacities Report
Overview of cluster capacities
| License Number | Raw Capacity | Total Usable | Available Capacity | Used |
| ${license_number} | " # RAW capacity raw_capacity=$(ansible -b -i /etc/filescale/cluster.ansible.yml storage_nodes -m shell -a "ssacli ctrl all show config | grep -o -P '(?<=SSD, ).*(?= TB)' | awk '{sum+=\$1} END {print sum}'" | awk '{sum+=$1} END {print sum}') echo "${raw_capacity} TB | " # usable total usable_total_bytes=$(influx -precision rfc3339 -database telegraf -execute 'SELECT last(minio_cluster_capacity_usable_total_bytes) as usable_total_bytes FROM telegraf.autogen.ec_s3_space_metrics' | grep -o -P '(?<=Z ).*(?=)') usable_total_TB=$(echo $usable_total_bytes | awk '{printf "%.1f\n", $usable_total_bytes / 1000 / 1000 / 1000 / 1000}') # is technically TiB echo "${usable_total_TB} TB | " # Available Capacity available_capacity_bytes=$(influx -precision rfc3339 -database telegraf -execute 'SELECT last(minio_cluster_capacity_usable_free_bytes) as usable_free_bytes FROM telegraf.autogen.ec_s3_space_metrics' | grep -o -P '(?<=Z ).*(?=)') available_capacity_TB=$(echo $available_capacity_bytes | awk '{printf "%.1f\n", $available_capacity_bytes / 1000 / 1000 / 1000 / 1000}') # is technically TiB echo "${available_capacity_TB} TB | " # Used Capacity used_capacity=$(echo $usable_total_bytes - $available_capacity_bytes | bc) used_capacity_TB=$(echo $used_capacity | awk '{printf "%.1f\n", $used_capacity / 1000 / 1000 / 1000 / 1000}') # is technically TiB echo "${used_capacity_TB} TB |
Overview of node capacities
| Node | Raw Capacity | Number of disks | Assigned to S3 | Unassigned |
| ${HOST} | " echo "${raw_per_node} TB | " echo "${disks} | " echo "${minio_disk} | " echo "${gluster_disks} |