I've been trying to do this for a while and I just can't seem to understand the vCLI SDK. I believe the MO that I want to use is
ServiceContent->Task Manager
, then print out the recent task. Here is my subroutine for doing it:
sub TaskManager {
my $begin;
my $mor = Vim::get_service_content()->taskManager;
my $taskmanager_view = Vim::get_view(mo_ref => $mor);
my $my_filterSpec = TaskFilterSpec->new();
my $eventArray = $taskmanager_view->CreateCollectorForTasks(filter => $my_filterSpec);
foreach (@$eventArray) {
# my $collector_view = Vim::get_view(mo_ref => $eventArray);
print $_->recentTask . "\n";
}
}
When I run this I either get:
Not an ARRAY reference at ./TaskManager.pl line 43.
When I change this, I then get:
subroutine &ManagedObjectReference::recentTask called at ./TaskManager.pl line 45
Here's one of the DOCS I've been looking at
https://www.vmware.com/support/developer/vc-sdk/visdk400pubs/ReferenceGuide/vim.TaskManager.html
I also have some conversations happening here: https://www.reddit.com/r/vmware/comments/4qfaql/help_with_vcli_perl_script/
EDIT: I changed my subroutine to the following:
sub TaskManager {
my $begin;
my $mor = Vim::get_service_content()->taskManager;
my $taskmanager_view = Vim::get_view(mo_ref => $mor);
my $my_filterSpec = TaskFilterSpec->new();
my $eventArray = $taskmanager_view->CreateCollectorForTasks(filter => $my_filterSpec);
foreach ($eventArray) {
my $newRecentTask = $taskmanager_view->description;
print $newRecentTask . "\n";
}
}
But the problem is that the print statement is returning a hash value, not something I can use. Any ideas how to get something readable?