Autostart in ESXi - how to monitor?

Hi,

I wonder, is it possible to monitor the autostart feature of ESXi using one of the existing ESXi/vCenter plugins?

The feature is seen here:

I have two objectives:

  1. Check that the Autostart feature is enabled globally

  2. Check that a particular VM is set as Autostart

Checking the plugins I was unable to find this, I hope you can point me in the right direction :slight_smile:

Best regards,

Steffen

I am also not aware of any plugin with this capability.

Is it worth to frequently check it or would be having it visualized in one (easier to reach) spot enough? My reason to ask is if the later is enough, I would recommend filing an issue for GitHub - Icinga/icingaweb2-module-vspheredb: The easiest way to monitor a VMware vSphere environment. as it has the more modern code and active development.

If it has to be a monitoring plugin I would recommend looking into the powershell sdk instead of the perl one as VMware is doing a horrible job with the perl one and writing your own plugin.

Thank you for the suggestion, Dirk, interesting stuff :slight_smile:

And yes, we are looking for just a standard monitoring plugin for this purpose.

We are currently running on rhel 7, btw - I guess the powershell sdk is still not available for this platform, or?

The perl vmware api is already in use for some other purposes here, so I guess we would be most inclined to continue in that direction if possible.

Ok, looks like something along the lines of this is probably the way forward. We will dig in.

my $host_view = Vim::find_entity_view(view_type => 'HostSystem', filter => $host, properties => ['name', 'configManager', 'config']);

my $state = ($host_view->config->autoStart->defaults->enabled) ? "YES" : "NO";
print "Autostart enabled: $state\n";

my $autoStartMgr = Vim::get_view(mo_ref => $host_view->configManager->autoStartManager);
my $powerInfo = $autoStartMgr->config->powerInfo;
if ($powerInfo) {
    foreach (@$powerInfo) {
        my $vmProp = Vim::get_view(mo_ref => $_->key, properties=>['name']);
        my $vmName = $vmProp->{'name'};
        my $startAction = $_->startAction;
        print "vmName: $vmName\nstartAction: $startAction\n";
    }
}

Autostart: YES
vmName: <vm1>
startAction: powerOn
vmName: <vm2>
startAction: powerOn
...

Yes should be easy.

Why I did not recommend the Perl SDK is quite simple. It uses Perl libraries that are quite old, deprecated and uncommon which makes installation and maintenance a burden and there is no support from the vendor (You only get support with a dev subscription but I did not find a way to get one when I was still doing vmware at my old employer and when I was doing research for a customer). But if you already have it up and running, no problem to stick with it.

And for the VsphereDB module I created an issue as I think it would be a nice feature to see autostart visualizied: Visualize autostart feature · Issue #235 · Icinga/icingaweb2-module-vspheredb · GitHub

And while doing so the same for DRS: Visualize DRS state · Issue #234 · Icinga/icingaweb2-module-vspheredb · GitHub

Feel free to comment on them if you have specific ideas.

Sounds good - we definitely like all kinds of easy stuff :smiley:

So, does this mean that the powershell sdk is available for rhel 7 - or which alternative for the perl api would you recommend on rhel 7?

And thank you for the feature requests - looks good :slight_smile:

After some bad experience I would write my own soap requests. At first it looks more complicated and could be too much for a simple plugin, but later on the code will be less bloated than the SDK and you avoid problems like in the past where the SDK could only be installed in a patched version as perl modules were not installable on a “modern” operatingssystem.

But as I said if you already have the SDK up and running feel free to use it, especially if you develop the plugin for internal use only.

Powershell runs fine on RHEL 7, but I have never tested the SDK on something else then Windows and this is also quite a while ago. The compatibility matrix says it is linux-compatible, but again the overhead would be big I think.

Currently we roll our own rpms from the VMware-vSphere-Perl-SDK-*.x86_64.tar.gz file, using an approach a.la. this:

So far it has been working ok for us.

I wonder if there are already less bloated “alternative” VMware APIs out there, with people creating their own unofficial wrappers in the way you describe. Interesting thought.

And thanks for the PowerShell info, it might be interesting for us to look into that at one point also :slight_smile: