VM Manger Proxy Inspectors

I’ve never queried against the hosts for guests vms… I’ve always just queried the guests directly (via the proxy of course). Are you not using the VM Manager proxy plugin to talk to the vCenter?

Somehow I transposed so try this

if (exists snapshots of guest vms) then ((name of it as string) of snapshots of guest vms) else ("Unknown")

Alan,

Is that a query for the vm hosts? via the agent or vm manager? I’ve never had a problem with “names of snapshots” and “number of snapshots”. I’m assuming we’re talking about VM Manager Proxy inspectors since thats the title of this thread.

If you look at the fixlets in the Virtual Endpoint Manager site and take a look at 723 (rename snapshot). One of it’s relevance clauses is: number of snapshots > 0

pretty straight forward to build on that.

What exactly are you querying? Via the agent or the proxy?

I don’t care just so I get a list of the names of the snapshots on each vm.
I see that one you mention and the snapshots >0

(((((if (in proxy agent context) then ((data type = “ESXi Hypervisor”) or (data type = “ESXi Hypervisor Virtual Machine”)) else ((name of operating system contains “Win”) or ((value “manufacturer” of structure “system_information” of smbios as string) contains “VMware”))) AND (in proxy agent context)) AND (data type = “ESXi Hypervisor Virtual Machine”)) AND (number of snapshots > 0)) AND (status of device != “unknown”)) AND (if exists (template of device) then (template of device = false) else false)

is there a way to use that to then list the names?

here’s that I have for an analysis:

<?xml version="1.0" encoding="UTF-8"?>
<BES xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="BES.xsd">
	<Analysis>
		<Title>Misc VM Info</Title>
		<Description><![CDATA[&lt;enter a description of the analysis here&gt; ]]></Description>
		<Relevance>if (in proxy agent context) then ((data type = "ESXi Hypervisor") or (data type = "ESXi Hypervisor Virtual Machine")) else ((name of operating system contains "Win") or ((value "manufacturer" of structure "system_information" of smbios as string) contains "VMware"))</Relevance>
		<Relevance>in proxy agent context</Relevance>
		<Relevance>data type = "ESXi Hypervisor Virtual Machine"</Relevance>
		<Source>Internal</Source>
		<SourceReleaseDate>2016-02-17</SourceReleaseDate>
		<MIMEField>
			<Name>x-fixlet-modification-time</Name>
			<Value>Thu, 07 Apr 2016 00:43:20 +0000</Value>
		</MIMEField>
		<Domain>SYST</Domain>
		<Property Name="Snapshot Count" ID="1">number of snapshots</Property>
		<Property Name="Snapshot Names" ID="3">names of snapshots</Property>
		<Property Name="BigFix Snapshot Exists" ID="6">exists snapshot whose (name of it = "BigFix")</Property>
	</Analysis>
</BES>

Bingo thank you that works

1 Like

I added two items and they work except for items with 0 snapshots and then one show error is there a way to eliminate the error?
Veeam Snapshot Exists
exists snapshot whose ((name of it contains “Veeam”) or (name of it contains “VEEAM”)) works with true or false but

this is the one that shows error if no snaps exits

Snapshot Creation
creation time of snapshots
error is
Singular expression refers to nonexistent object.

try this:

if (number of snapshots > 0) then (exists snapshot whose (name of it as lowercase contains “veeam”) else (false)

It is the creation time of snapshots that is having the issue the veeam one works as expected.

Trying
if (number of snapshots > 0) then creation time of snapshots else “no snapshot”

for the Snapshot Creation

how about:

if ((number of snapshots > 0) and (exists snapshot whose (name of it as lowercase contains “veeam”)) then (creation time of snapshot whose (name of it as lowercase contains “veeam”)) else “no snapshot”

They are two separate items and I want the creation time even if it doesnt have veeam in it.
I am currently getting Snapshot Creation Incompatible types.
with the

if (number of snapshots > 0) then creation time of snapshots else “no snapshot”

1 Like

trying

if exists snapshots then creation time of snapshots else “no snapshot”

creation time of snapshots works for ones with a creation time

and since it looks to be an issue with getting a time
creation time of : time

as the else I think I am ok with the error.

When using an if…then…else construct, both results have to be the same data type. “creation time of snapshots” is a time, you can’t have an else of type string “no snapshot”. Couple of ways to get around it. You could cast the creation times as a string (but lose the date/time sorting), or you could cast the “no snapshot” as error, or return ‘nothing’ instead. You are also checking a singular “creation time” against a plural “snapshots”. Try something like one of these…

if exists snapshots then creation times of snapshots else nothing

if exists snapshots then creation times of snapshots else error "no snapshots"

if exists snapshots then (creation times of snapshots as string) else "no snapshot"

if exists snapshots then (maximum of creation times of snapshots) else nothing

creation times of snapshots whose (name of it as lowercase contains "veeam")

That is what I had figured out was that I needed a comparable type.
This does work as expected
if exists snapshots then creation times of snapshots else nothing

I get none or the time, I will create multiple snapshots on one vm and check then as well as currently I do not have any with more than one snapshot.

Glad to hear it. If you want it even shorter, you can use one of

creation times of snapshots 

or

creation times of snapshots whose (name of it as lowercase contains "veeam")

…those will return “nothing” anyway if no snapshots exist. Because we’re using the plural forms of “creation times of snapshots”, there’s no error because 0 results is valid for plurals.

1 Like

OK it now al shows but the count is only going to 1 and giving that name and creation time.
Not getting any errors but not getting the list of the other snapshots either I have one with 5, I am looking to be able to determine if I have more than one if the same name and that name is the goal.

this is current attempt

Name="Snapshot Count"
number of snapshots

Name="Snapshot Names"
names of snapshots

Name="Veeam Snapshot Exists"
exists snapshot whose (name of it as lowercase contains “veeam”)

Name="Snapshot Creation"
if exists snapshots then creation times of snapshots else nothing

Any ideas on getting accurate count >1 and multiple results for the names and creation times?