-
Notifications
You must be signed in to change notification settings - Fork 5
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Feature request implement command to Backup to location #13
Comments
Hi |
there is an settings inside the OVGD to schedule a backup, If this is not sufficient you could schedule it also with an script with the follwing rest commands: Login: sessionID=$(curl -s -X POST #create an Backup #getting downloadURI #download the backup curl -s -X GET Tried it in an curl/Linux env, but perhaps not too hard to translate to POSH?? |
Danke
Van: "stephan-koch" <[email protected]>
Aan: "rumart/GlobalDashboardPS" <[email protected]>
Cc: "marc" <[email protected]>, "Author" <[email protected]>
Verzonden: Zondag 26 januari 2020 10:37:08
Onderwerp: Re: [rumart/GlobalDashboardPS] Feature request implement command to Backup to location (#13)
there is an settings inside the OVGD to schedule a backup, If this is not sufficient you could schedule it also with an script with the follwing rest commands:
Login:
OVGDIP=10.0.X.X
sessionID=$(curl -s -X POST
https://${OVGDIP}/rest/login-sessions
-H 'Content-Type: application/json'
-H 'X-API-Version: 2'
-k
-d '
{
"authLoginDomain":"local",
"password":"XXXXXX",
"userName":"localUser"
}' | jq -r ".sessionID")
#create an Backup
curl -s -X POST
https://${OVGDIP}/rest/backups
-H 'Content-Type: application/json'
-H "auth: $sessionID"
-H 'x-api-version: 2'
-k | python -m json.tool
#getting downloadURI
BACKUPURI=$(curl -s -X GET
https://${OVGDIP}/rest/backups
-H 'Content-Type: application/json'
-H "auth: $sessionID"
-H 'x-api-version: 2'
-k| jq -r ".members[].downloadUri " )
echo $BACKUPURI
#download the backup
TAG=$(date +%d%m%Y)
OUTFILE="OVGD-Backup.$TAG.bkp"
curl -s -X GET
https://${OVGDIP}$BACKUPURI
-H 'Content-Type: application/json'
-H "auth: $sessionID"
-H 'x-api-version: 2'
-k -o $OUTFILE
Tried it in an curl/Linux env, but perhaps not too hard to translate to POSH??
—
You are receiving this because you authored the thread.
Reply to this email directly, [ #13 | view it on GitHub ] , or [ https://github.com/notifications/unsubscribe-auth/AHPGJLVSZ3PIN2BRGCOD43DQ7VKUJANCNFSM4KGXGDJA | unsubscribe ] .
|
here an example for an POSH script which could certainly improved, but my POSH knowledge is really basic: $IP="10.0.XX,XX" #if(!$Password){ $Password = (Read-Host -Prompt "Type your password" -AsSecureString)}#for some SSL / Security reasons .... $code = @"
} #compile the class [System.Net.ServicePointManager]::ServerCertificateValidationCallback = [SSLHandler]::GetSSLHandler() #Creation of the header $body = @{} $Connection=Invoke-WebRequest -Uri "https://$IP/rest/login-sessions" -ContentType "application/json" -Headers $headers -Method POST -UseBasicParsing -Body $bodyjson
$headers["auth"] = $key #Creating the body with the deployment group URI #wait for the backup to complete #get DownloadURI #download it ... |
Backup to location like for the oneview PS lib "New-HPOVBackup -Location $Location "
thanks in advance.
The text was updated successfully, but these errors were encountered: