Reply to Message

View discussion in a popup

Replying to:
natxoasenjo
Enthusiast
Enthusiast

help with datetimeinfo


hi,


this is probably a simple question but I do not seem to get it right.


With this code:


# get all esx hosts in Datacenter

my $esxhost_view = Vim::find_entity_views(

    view_type  => 'HostSystem',

    properties =>

);


for my $host ( sort { $a->name cmp $b->name } @$esxhost_view ) {


    print $host->name . "\n";
    #print Dumper $host;
    print $host->config->dateTimeInfo;


}

I see I get all the required info from virtual center (both dumping it with Data::Dumper or with the --verbose flag on the script. But when I run it  I keep getting:


Can't call method "dateTimeInfo" on an undefined value at bin/check_esx_time line 30.


How do I get to the ntp config of the esx hosts? I found the vmware health check (<a class="jive-link-external-small" href="https://github.com/lamw/vghetto-scripts/blob/master/perl/vmwareHealthCheck.pl">https://github.com/lamw/vghetto-scripts/blob/master/perl/vmwareHealthCheck.pl</a>) which seems to do the same I am attempting (see from line 1665) but no cookie.


Thanks in advance for any assistance.

Reply
0 Kudos