VMware Cloud Community
jlorenzo
Contributor
Contributor

ESXi snapshot backup with local storage

I have a ESXi server with 2 datastores in the local storage (several internal RAID 5 disks), and i want to use Christian Gruetzner´s script to backup up the snapshot of all virtual machines..

It´s possible to do that without external storage (SAN, NAS o another..)??, i am receiving a "Unsuccessfull: 500 internal server error" when the script try to copy the snapshots on the local storage (NFS shared folder on a windows machine added like a local datastore on ESXi), this is the error.

GET unsuccessful : 500 Internal Server Error

I had installed in the windows machine in which i am running backup script ,VIclient and SDK tools and copied sdk\wsdl folder of my windows machine to esxi server...

Somebody can tell me what is the problem?

Thanks

Reply
0 Kudos
9 Replies
abelpanno
Contributor
Contributor

I am having the same issue with only 1 of my images. All the rest seem to work. Did you find out what could be causing this error?

Reply
0 Kudos
jlorenzo
Contributor
Contributor

My problem is in one Esxi server with 3 virtual machines. From my Xp with vi-remotecli 3.5 installed and the Christian Gruetzner´s script...

Does someone can help us with this error code?

Thanks

Reply
0 Kudos
abelpanno
Contributor
Contributor

I found the answer to my issue. The name of the server and the name of the .vmx file on you ESXi server must be identical, case sensitive. I must have renamed the server at some point. All I did was rename it back and presto it worked. The script that I use is posted below.

#

#

  1. ESXi 3.5 Backup Script

#

  1. Autor: Christian Gruetzner

#

#

#############################################################################

#

#2008-08-22 V 1.0 Basic Script

  1. Functions: - create snapshots of all local VM's

  2. - get files from ESX-Datastore to local Store

  3. - exclude unneccessary files from backup

  4. - remove all created snapshots

  5. - actual time in log

#

#############################################################################

my $url = "https://ESXSERVER:443/sdk/vimService"; #URL to your ESX Host, default: <[https://IP-Address:Port/sdk/vimService]>

my $username = ""; #Username

my $password = ""; #User password

my $snapshotname = "BackupSnap"; #Name of your Snapshot

my $DSPath = "[datastore1]"; #Datastore name on ESX Host, example

my @VMNames;

#$VMNames[0] = ""; #Uncomment the next lines if you like to backup more vm's

#$VMNames[1] = "";

#$VMNames[2] = "";

#$VMNames[3] = "";

#$VMNames[4] = "";

#$VMNames[5] = "";

#$VMNames[6] = "";

#$VMNames[7] = "";

#$VMNames[8] = "";

#$VMNames[9] = "";

my $RCLIPath = "C:/Progra~1/VMware/VMware"; #VI Remote CLI Path (Windows: Use ONLY Short Folder Names!!!!)

#my $DestPath = "c:/vmimages/"; #Destination Path you like to copy to (Windows: Use ONLY Short Folder Names!!!!)

#IMPORTANT!!! -- Under DestPath must exist the VMNames Folder

#(For Example if your VMNames[0] = "ServerA" and your DestPath = "D:/": D:/ServerA/)

#----


  1. For the short folder name use "dir /X"

#call the sub function (at the bottom)

&actualtime();

print " ***** Script Start *************************\n\n";

&actualtime();

print "

-


Create Snapshots of running VM's -


";

print "\n\n";

system("perl $RCLIPath/Perl/apps/vm/snapshotmanager.pl --url $url --username $username --password $password --operation create --powerstatus poweredOn --snapshotname $snapshotname");

print "\n\n";

&actualtime();

print "

-


Copy VM files to local storage -


";

print "\n\n";

my $i = 0;

#special loop for arrays. run as long the array has data

foreach (@VMNames)

{

#read all available files and save filenames in the cache-array

my @cache = `perl $RCLIPath/bin/vifs.pl --url $url --username $username --password $password --dir \"$DSPath $VMNames[$i]\"`;

#run as long the cache array has data and save the value everytime in $filename

foreach my $filename (@cache)

{

#exclude uninterresting files from backup to save backup space

if($filename !~ /.log/ && $filename !~ /.vswp/ && $filename !~ /.vmsn/ && $filename !~ /-delta/)

{

#remove the "\n" at the end of $filename to prevent a error massage in log

chomp($filename)

&actualtime();

print "-----

Copy File: ";

print $filename;

#get files from VM Datastore to a local Storage

system("perl $RCLIPath/bin/vifs.pl --url $url --username $username --password $password --get \"$DSPath $VMNames[$i]/$filename\" \"$DestPath$VMNames[$i]/$filename\"");

print "\n";

}

}

$i++;

}

print "\n\n";

&actualtime();

print "

-


Remove Snapshots of running VM's -


";

print "\n\n";

system("perl $RCLIPath/Perl/apps/vm/snapshotmanager.pl --url $url --username $username --password $password --operation remove --powerstatus poweredOn --snapshotname $snapshotname --children 1");

print "\n\n";

&actualtime();

print " ***** Script End ***************************";

#sub function to print the actual time in the log

sub actualtime

{

my ($Sekunden, $Minuten, $Stunden, $Monatstag, $Monat,

$Jahr, $Wochentag, $Jahrestag, $Sommerzeit) = localtime(time);

my $CTIME_String = localtime(time);

$Monat+=1;

$Jahrestag+=1;

$Monat = $Monat < 10 ? $Monat = "0".$Monat : $Monat;

$Monatstag = $Monatstag < 10 ? $Monatstag = "0".$Monatstag : $Monatstag;

$Stunden = $Stunden < 10 ? $Stunden = "0".$Stunden : $Stunden;

$Minuten = $Minuten < 10 ? $Minuten = "0".$Minuten : $Minuten;

$Sekunden = $Sekunden < 10 ? $Sekunden = "0".$Sekunden : $Sekunden;

$Jahr+=1900;

print "$Jahr-$Monat-$Monatstag $Stunden:$Minuten:$Sekunden";

}

Reply
0 Kudos
jlorenzo
Contributor
Contributor

Is the same Script than i am trying.. The name of the servers .vmx files is the same that the each Vm one, for the Vm "server1" the vmx file is "server1.vmx"...

In The my $url = "https://IPESXiSERVER:443/sdk/vimService" if i put the 443 port i received this error: GET https://134.134.20.202/folder/datastore2%20server1 unsuccessful : 404 Not Found...

Any idea??

Thanks a lot..

Reply
0 Kudos
abelpanno
Contributor
Contributor

If you browse to the server can you open up the web console??? ex:

You need to setup a FQDN in your DNS server for you ESXI server and then put that FQDN within you ESXI server throught the console directly at the server itself. Then click test communications and everything should pass. Once that happens I believe you should be able to use that script b/c it will turn on SSL on 443

Reply
0 Kudos
jlorenzo
Contributor
Contributor

When i browse to or , appears the security alert of the certificate, with this message: the security cerficate name is invalid or does not coincide with the site, dou yoy want to continue? if i click yes appears VMware ESX Server 3i

Welcome.. getting started Download VMware Infrastructure Client and all the vmware resources available.

I changed the name of the ESXi server and then regenerate the certificate with #create_certificates, in my /etc/hosts filei have the lines 127.0.0.1 localhost.localdomain and 10.0.100.x servername.domain.es

In my windows DNS servers i had created the Host registry with te esxi server name, domain and Ip.

Thanks for your help

Reply
0 Kudos
abelpanno
Contributor
Contributor

did it fix your 404 not found error in your script?

Reply
0 Kudos
jlorenzo
Contributor
Contributor

No... The error is the same...

2009-01-27 14:53:23 -


Create Snapshots of running VM's -


Operation :: Snapshot Prueba for virtual machine nt_proj created sucessfully

under host esxi.domain.es

Operation :: Snapshot Prueba for virtual machine ntfax created sucessfully unde

r host esxi.ifema.es

2009-01-27 14:53:36 -


Copy VM files to local storage -


GET https://esxi.domain.es/folder/ARRAY(0x286020)%20ntfax unsuccessful : 404

Not Found

Reply
0 Kudos
Brad_Crossman
Contributor
Contributor

I have the exact same issue.

2009-09-17 08:10:33 ***** Script Start *************************

2009-09-17 08:10:33 -


Create Snapshots of running VM's -


Operation :: Snapshot BackupSnap for virtual machine New Virtual Machine created sucessfully under host QA-LOAD-SQL.GOLD.COM

Operation :: Snapshot BackupSnap for virtual machine BRT-GOLD-QALR created sucessfully under host QA-LOAD-SQL.GOLD.COM

Operation :: Snapshot BackupSnap for virtual machine BRT-GOLD-LDSQL created sucessfully under host QA-LOAD-SQL.GOLD.COM

2009-09-17 08:10:53 -


Copy VM files to local storage -


GET https://10.2.6.61/folder/datastore1%20BRT-GOLD-QALR unsuccessful : 404 Not Found

Any ideas? I see it's placing %20 between the DS and VM name instead of /. Not sure why.

Reply
0 Kudos