1 person found this helpful
Do you mean the server IP/FQDN? Or you want to store the VIM object so you can reuse it? Basically the SOAP is all session based. So long as your cookie based SID is saved you can reconnect. But the Perl SDK has an a save session option just for that scenario.
Might need more information to understand what you're looking to do.
I need the server vCenter server FQDN,
What i am doing now is the following:
my $content = Vim::get_service_content();
my $vpxsetting = Vim::get-view(mo_ref => $content->setting);
my $query_vpx = $vpxsetting->QueryOptions(name=>"VirtualCenter.InstanceName");
The $query_vpx is an array, but i have some troubles getting the FQDN from this array.
It's been to long since i last used perl for VMware.
You can get the vCenter instance name by using that advanced key VirtualCenter.InstanceName as you mentioned, but this is not guaranteed to match the actual hostname of your vCenter.
If I understand you correctly and you're using vSphere SDK for Perl and you're already connected to vCenter server since you're querying for the advanced VPX configurations, you can actually get the IP or Hostname by doing the following:
my $server = Opts::get_option('server');
VMware has already created a few modules that helps creating new vSphere SDK for Perl scripts and handles most of the authentication and by default you can access the username, password and server among other variables. So if you're already connecting to vCenter using IP or FQDN, you can just extract that variable out. Now if you want the full FQDN and you're connecting via IP, then just use Perl to do a reverse lookup, assuming DNS is fully functional in your environment as it should be.
VMware vExpert 2009,2010
VMware scripts and resources at: http://www.virtuallyghetto.com/
If you find this information useful, please award points for "correct" or "helpful".
Thanks, Why didn it hink of that.
I has been a while ago since i last used perl for vmware. I am a bit rusty