Script aufgeräumt.
This commit is contained in:
parent
ade57c0a83
commit
1313205807
@ -7,19 +7,23 @@ function ConvertToTiB () {
|
|||||||
if awk "BEGIN{exit ($StorageInTB > 1000 ? 0 : 1)}"
|
if awk "BEGIN{exit ($StorageInTB > 1000 ? 0 : 1)}"
|
||||||
then
|
then
|
||||||
StorageInTB=$(echo $StorageInTB | awk '{printf "%.1f\n", $1 / 1024}')
|
StorageInTB=$(echo $StorageInTB | awk '{printf "%.1f\n", $1 / 1024}')
|
||||||
echo $StorageInTB TB # is technically TiB
|
|
||||||
|
echo $StorageInTB TB
|
||||||
else
|
else
|
||||||
StorageInGB=$StorageInTB
|
StorageInGB=$StorageInTB
|
||||||
echo $StorageInGB GB # is technically GiB
|
echo $StorageInGB GB
|
||||||
fi
|
fi
|
||||||
else
|
else
|
||||||
StorageInGB=$1
|
StorageInGB=$1
|
||||||
echo $StorageInGB MB # is technically MiB
|
echo $StorageInGB MB
|
||||||
|
>>>>>>> 7b3a121 (Script aufgeräumt.)
|
||||||
fi
|
fi
|
||||||
}
|
}
|
||||||
|
|
||||||
function ConvertOnlyToTB () {
|
function ConvertOnlyToTB () {
|
||||||
SpaceInTB=$(echo $1 | awk '{printf "%.1f\n", $1 / 1024}') # is technically TiB
|
|
||||||
|
SpaceInTB=$(echo $1 | awk '{printf "%.1f\n", $1 / 1024}')
|
||||||
|
>>>>>>> 7b3a121 (Script aufgeräumt.)
|
||||||
echo $SpaceInTB
|
echo $SpaceInTB
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -35,6 +39,26 @@ 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 '(?<=HDD, ).*(?= TB)' | awk '{sum+=\$1} END {print sum}'" | awk '{sum+=$1} END {print sum}')
|
||||||
|
|
||||||
|
# Usable Capacity
|
||||||
|
getArray=$(ansible -b -i /etc/filescale/cluster.ansible.yml storage_nodes -m shell -a "ssacli ctrl all show config | grep -o -P '(?=Array ).*(?= \()' | grep -v Slot | sort -u | wc -l" | awk '{sum+=$1} END {print sum}')
|
||||||
|
diskCount=$(ansible -b -i /etc/filescale/cluster.ansible.yml storage_nodes -m shell -a "ssacli ctrl all show config | grep -v SSD | grep physicaldrive | wc -l" | awk '{sum+=$1} END {print sum}')
|
||||||
|
lostDisks=$(($getArray * 2))
|
||||||
|
disks=$(($diskCount - $lostDisks))
|
||||||
|
diskSize=$(sudo ssacli ctrl all show config | grep -o -P '(?<=HDD, ).*(?= TB)' | sort -u | tail -1)
|
||||||
|
usable_capacity=$(($disks * $diskSize))
|
||||||
|
|
||||||
|
# Available Capacity
|
||||||
|
available_capacity_GB=$(ansible -b -i /etc/filescale/cluster.ansible.yml storage_nodes -m shell -a "ssacli ctrl all show config | grep 'Unused Space:' | grep -o '[[:digit:]]*'" | awk '{sum+=$1} END {sum=sum/1024} END {print sum}')
|
||||||
|
available_capacity_TB=$(ConvertOnlyToTB $available_capacity_GB)
|
||||||
|
|
||||||
|
# Allocated Capacity
|
||||||
|
allocated_capacity_TB=$(awk "BEGIN {print $usable_capacity - $available_capacity_TB}")
|
||||||
|
|
||||||
|
>>>>>>> 7b3a121 (Script aufgeräumt.)
|
||||||
# CSS/html/bash
|
# CSS/html/bash
|
||||||
(
|
(
|
||||||
echo "To: ${recipient}"
|
echo "To: ${recipient}"
|
||||||
@ -88,27 +112,20 @@ recipient=$(grep -w recipient /etc/filescale/cluster.yml | grep -o -P '(?<=recip
|
|||||||
<tr>
|
<tr>
|
||||||
<td> License Number </td>
|
<td> License Number </td>
|
||||||
<td> Raw Capacity </td>
|
<td> Raw Capacity </td>
|
||||||
<td> Allocated Capacity </td>
|
|
||||||
<td> Available Capacity </td>
|
|
||||||
<td> Usable Capacity </td>
|
<td> Usable Capacity </td>
|
||||||
|
<td> Available Capacity </td>
|
||||||
|
<td> Allocated Capacity </td>
|
||||||
</tr>
|
</tr>
|
||||||
<tr>"
|
<tr>"
|
||||||
# License number
|
|
||||||
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 '(?<=HDD, ).*(?= 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>"
|
||||||
# Allocated Capacity
|
echo "<td> ${usable_capacity} TB </td>"
|
||||||
allocated_capacity_GB=$(df -BG | grep '/gluster/repositories/' | grep -v fs-ss | grep -v '/tmp/' | awk '{ sum+=$2} END {print sum}')
|
|
||||||
allocated_capacity_TB=$(ConvertOnlyToTB $allocated_capacity_GB) # is technically TiB
|
|
||||||
echo "<td> ${allocated_capacity_TB} TB </td>"
|
|
||||||
# Available Capacity
|
|
||||||
available_capacity_GB=$(ansible -b -i /etc/filescale/cluster.ansible.yml storage_nodes -m shell -a "ssacli ctrl all show config | grep 'Unused Space:' | grep -o '[[:digit:]]*'" | awk '{sum+=$1} END {sum=sum/1024} END {print sum}')
|
|
||||||
available_capacity_TB=$(ConvertOnlyToTB $available_capacity_GB) # is technically TiB
|
|
||||||
echo "<td> ${available_capacity_TB} TB </td>"
|
echo "<td> ${available_capacity_TB} TB </td>"
|
||||||
# Usable Capacity
|
echo "<td> ${allocated_capacity_TB} TB </td>
|
||||||
usable_capacity=$(echo $allocated_capacity_TB + $available_capacity_TB | bc) # is technically TiB
|
|
||||||
echo "<td> ${usable_capacity} TB </td>
|
|
||||||
|
>>>>>>> 7b3a121 (Script aufgeräumt.)
|
||||||
</tr>
|
</tr>
|
||||||
<tr>
|
<tr>
|
||||||
<!-- <td colspan="3"> Further information about possible extensions. </td> -->
|
<!-- <td colspan="3"> Further information about possible extensions. </td> -->
|
||||||
@ -178,3 +195,6 @@ echo "<tr>
|
|||||||
"
|
"
|
||||||
) | sudo sendmail -t -f $sender
|
) | sudo sendmail -t -f $sender
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
>>>>>>> 7b3a121 (Script aufgeräumt.)
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user