Script für S3 Setups die nur SSDs verwenden aufgeräumt.
This commit is contained in:
parent
3033f19750
commit
efb2bc4a85
@ -24,7 +24,7 @@ function ConvertOnlyToTB () {
|
|||||||
}
|
}
|
||||||
|
|
||||||
function GetRepoCapacity () {
|
function GetRepoCapacity () {
|
||||||
getRepoValue=$(df -BM --output=$1,target | grep -w -m 1 $2 | sed 's/[[:blank:]]*//' | sed s'/\M.*//'); \
|
getRepoValue=$(df -BM --output=$1,target | grep -w -m 1 $2 | sed 's/[[:blank:]]*//' | sed s'/\G.*//'); \
|
||||||
getRepoValue=$(ConvertToTB $getRepoValue)
|
getRepoValue=$(ConvertToTB $getRepoValue)
|
||||||
echo $getRepoValue $3; \
|
echo $getRepoValue $3; \
|
||||||
}
|
}
|
||||||
@ -34,6 +34,21 @@ license_number=$(grep -w 'license_number' /etc/filescale/cluster.ansible.yml | g
|
|||||||
sender=$(grep -w sender /etc/filescale/cluster.yml | grep -o -P '(?<=sender: ).*(?=)')
|
sender=$(grep -w sender /etc/filescale/cluster.yml | grep -o -P '(?<=sender: ).*(?=)')
|
||||||
recipient=$(grep -w recipient /etc/filescale/cluster.yml | grep -o -P '(?<=recipient: ).*(?=)')
|
recipient=$(grep -w recipient /etc/filescale/cluster.yml | grep -o -P '(?<=recipient: ).*(?=)')
|
||||||
|
|
||||||
|
# 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}')
|
||||||
|
|
||||||
|
# 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
|
||||||
|
|
||||||
|
# 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
|
||||||
|
|
||||||
|
# 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 "To: ${recipient}"
|
echo "To: ${recipient}"
|
||||||
echo "From: ${sender}"
|
echo "From: ${sender}"
|
||||||
@ -93,20 +108,9 @@ recipient=$(grep -w recipient /etc/filescale/cluster.yml | grep -o -P '(?<=recip
|
|||||||
<tr>"
|
<tr>"
|
||||||
|
|
||||||
echo "<td> ${license_number} </td>"
|
echo "<td> ${license_number} </td>"
|
||||||
# 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 "<td> ${raw_capacity} TB </td>"
|
echo "<td> ${raw_capacity} TB </td>"
|
||||||
# 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 "<td> ${usable_total_TB} TB </td>"
|
echo "<td> ${usable_total_TB} TB </td>"
|
||||||
# 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 "<td> ${available_capacity_TB} TB </td>"
|
echo "<td> ${available_capacity_TB} TB </td>"
|
||||||
# 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 "<td> ${used_capacity_TB} TB </td>
|
echo "<td> ${used_capacity_TB} TB </td>
|
||||||
</tr>
|
</tr>
|
||||||
<tr>
|
<tr>
|
||||||
@ -149,3 +153,4 @@ echo "<tr>
|
|||||||
</html>
|
</html>
|
||||||
"
|
"
|
||||||
) | sudo sendmail -t -f $sender
|
) | sudo sendmail -t -f $sender
|
||||||
|
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user