i'm trying to access the threshold values for alarms
$alarmDef = Get-AlarmDefinition "Datastore usage*"
$alarmDef.extensiondata.expression.expression.
results in:
Operator : isAbove
Type : Datastore
Metric : VMware.Vim.PerfMetricId
Yellow : 8500
YellowInterval :
Red : 9000
RedInterval :
DynamicType :
DynamicProperty :
So I can see the yellow (8500) and red (9000) values from above. so I go
$alarmDef.extensiondata.expression.expression.yellow
but it returns nothing?
The correct path is
$alarmDef.extensiondata.Info.expression.expression
but I assume that was just a typo.
The Expression property points to an array, so even if there is only 1 expression, you still have to use an index.
Like this
$alarmDef.extensiondata.Info.expression.expression[0].Yellow
Blog: lucd.info Twitter: @LucD22 Co-author PowerCLI Reference
The correct path is
$alarmDef.extensiondata.Info.expression.expression
but I assume that was just a typo.
The Expression property points to an array, so even if there is only 1 expression, you still have to use an index.
Like this
$alarmDef.extensiondata.Info.expression.expression[0].Yellow
Blog: lucd.info Twitter: @LucD22 Co-author PowerCLI Reference
Hi Lucd, thanks for the response.
That's odd, I don't have a $alarmDef.extensiondata.Info property, and nothing outputs when i try it. I can only see that data under $alarmdef.ExtensionData.Expression.Expression
and when I try $alarmdef.ExtensionData.Expression.Expression.yellow[0] I get "Cannot index into a null array."
i'm running VMWare vSphere PowerCLI 4.1 U1 build 332441
The 2nd Expression property is an array, that is the one you need to index.
$alarmdef.ExtensionData.Expression.Expression[0].yellow
Blog: lucd.info Twitter: @LucD22 Co-author PowerCLI Reference
d'oh, that'll teach me to read things properly
thanks!