This commit is contained in:
2024-01-26 16:33:11 -06:00
parent 3249c1177d
commit 99ef0ab83f
3 changed files with 8 additions and 68 deletions

View File

@@ -1,5 +1,5 @@
VERS='2.5.160-01252024'
VERS='2.5.162-01262024'
noheader=' update service dailytemp confsync -r -report '

View File

@@ -1,17 +1,5 @@
#!/usr/bin/env pwsh
# 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 $VCENTERHOST -Protocol https -User $VCENTERUSER -Password $VCENTERPASS | Out-Null
@@ -19,4 +7,4 @@ Connect-VIServer -Server $VCENTERHOST -Protocol https -User $VCENTERUSER -Passwo
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 $VCENTERHOST -Force Confirm:$false
Disconnect-VIServer -Server $VCENTERHOST -Force Confirm:$false

View File

@@ -715,63 +715,15 @@ 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
#
# 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 -e "\n${idsCL[Green]}ALL VCENTER VM SNAPHOTS ${idsCL[Default]}(minus replicas)"
DIVIDER . lightGreen 70
echo -en "\n${idsCL[Green]}Connecting to vCenter and gathering snapshots ..."
snapshots=`${PW_FOLDER}/esxi-scripts/get-snapshots.ps1`
echo -en "\033[2K\e[0K\r"
echo -e "${snapshots}"
echo
}
GET_SNAPSHOTS_SUB(){
SENSOR=${1}
ESXIHOST=${PW_HOST_ADDRESSES[${SENSOR}]}
tmpfile=/tmp/.getsnaphots.${SENSOR}
touch ${tmpfile}.running
echo -e "${idsCL[LightGreen]}${PW_ESXI_HOST_NAMES[${ESXIHOST}]} [${ESXIHOST}] " >> ${tmpfile}.running
DIVIDER . lightGreen 70 >> ${tmpfile}.running
snapshots=`${PW_FOLDER}/esxi-scripts/get-snapshots.ps1 ${ESXIHOST}`
if [ "${snapshots}" != "" ]; then
echo -e "${snapshots}" >> ${tmpfile}.running
# for snapshot in $(echo ${snapshots} | jq -r '.[] | @base64'); do
# vm=`echo ${snapshot} | base64 --decode | jq -r '.VM'`
# name=`echo ${snapshot} | base64 --decode | jq -r '.Name'`
# created=`echo ${snapshot} | base64 --decode | jq -r '.Created'`
# size=`echo ${snapshot} | base64 --decode | jq -r '.SizeGB'`
# echo "$vm - $name - ${c}reated - $size"
# done
else
# echo -e "\033[2K\e[0K\r No snapshots found"
echo -e " No snapshots found" >> ${tmpfile}.running
fi
DIVIDER true lightGreen 70 >> ${tmpfile}.running
mv ${tmpfile}.running ${tmpfile}.done
}
CONFSYNC(){
rsync -az --timeout=3 ${PW_FOLDER}/settings.conf root@10.2.1.1:${PW_FOLDER}/ & >/dev/null 2>&1