This commit is contained in:
2024-01-26 16:26:17 -06:00
parent 68051d4fbd
commit 3249c1177d
2 changed files with 41 additions and 27 deletions

View File

@@ -1,11 +1,22 @@
#!/usr/bin/env pwsh
Set-PowerCLIConfiguration -InvalidCertificateAction Ignore -Confirm:$false | Out-Null
# Set-PowerCLIConfiguration -InvalidCertificateAction Ignore -Confirm:$false | Out-Null
# . /opt/idssys/powerwall/settings.ps1
#
# Connect-VIServer -Server $args[0] -Protocol https -User $ESXiUsername -Password $ESXiPassword | Out-Null
#
# get-vm | get-snapshot | where {($_.vm -notlike '*_replica')} | select vm, name, description, created, sizegb
# # get-vm | get-snapshot | where {($_.vm -notlike '*_replica')} | select vm, name, description, created, sizegb | ConvertTo-Json -Depth 1 -WarningAction:SilentlyContinue
#
# Disconnect-VIServer -Server $args[0] -Force Confirm:$false
. /opt/idssys/powerwall/settings.ps1
Connect-VIServer -Server $args[0] -Protocol https -User $ESXiUsername -Password $ESXiPassword | Out-Null
Connect-VIServer -Server $VCENTERHOST -Protocol https -User $VCENTERUSER -Password $VCENTERPASS | Out-Null
get-vm | get-snapshot | where {($_.vm -notlike '*_replica')} | select vm, name, description, created, sizegb
# get-vm | get-snapshot | where {($_.vm -notlike '*_replica')} | select vm, name, description, created, sizegb | ConvertTo-Json -Depth 1 -WarningAction:SilentlyContinue
Disconnect-VIServer -Server $args[0] -Force Confirm:$false
Disconnect-VIServer -Server $VCENTERHOST -Force Confirm:$false

View File

@@ -716,31 +716,34 @@ LOGROTATE(){
GET_SNAPSHOTS(){
echo
rm -f /tmp/.getsnaphots.*
ncount=0
for SENSOR in ${PW_SENSOR_ORD[@]}; do
if [ "${PW_HOST_ADDRESSES[${SENSOR}]}" != "" ]; then
GET_SNAPSHOTS_SUB ${SENSOR} &
((ncount++))
fi
done
# rm -f /tmp/.getsnaphots.*
# ncount=0
# for SENSOR in ${PW_SENSOR_ORD[@]}; do
# if [ "${PW_HOST_ADDRESSES[${SENSOR}]}" != "" ]; then
# GET_SNAPSHOTS_SUB ${SENSOR} &
# ((ncount++))
# fi
# done
#
# nc_count=0; completed=false
# until [ "${completed}" == "true" ]; do
# for snaphots in /tmp/.getsnaphots.*.done; do
# if [[ "${snaphots}" != *"*"* ]]; then
# snaphots_output=$(cat ${snaphots})
# [ "${snaphots_output}" != "" ] && echo -e "${snaphots_output}\n"
# rm -f ${snaphots}
# ((nc_count++))
# fi
# done
# if [ ${nc_count} -eq ${ncount} ]; then
# completed=true
# break
# fi
# sleep 2s
# done
nc_count=0; completed=false
until [ "${completed}" == "true" ]; do
for snaphots in /tmp/.getsnaphots.*.done; do
if [[ "${snaphots}" != *"*"* ]]; then
snaphots_output=$(cat ${snaphots})
[ "${snaphots_output}" != "" ] && echo -e "${snaphots_output}\n"
rm -f ${snaphots}
((nc_count++))
fi
done
if [ ${nc_count} -eq ${ncount} ]; then
completed=true
break
fi
sleep 2s
done
${PW_FOLDER}/esxi-scripts/get-snapshots.ps1
echo
}
GET_SNAPSHOTS_SUB(){