Any possible ways/ scripts available to create new alarm definitions in vCenter Server ..?
Couldnt find any suitable cmdlet to create a new alarm definition ..
-- Georgey
Have a look at my Alarm expressions – Part 1 : Metric alarms and Alarm expressions – Part 2 : Event alarms posts.
Those are 2 examples on how to use the CreateAlarm method for different types of alarms.
Blog: lucd.info Twitter: @LucD22 Co-author PowerCLI Reference
I'm afraid there isn't such a cmdlet for now.
You can create triggers and actions on an existing alarm with cmdlets.
To create an alarm from scratch you will have to use the SDK method.
Which specific type of alarm do you want to create ?
Blog: lucd.info Twitter: @LucD22 Co-author PowerCLI Reference
Have a look at my Alarm expressions – Part 1 : Metric alarms and Alarm expressions – Part 2 : Event alarms posts.
Those are 2 examples on how to use the CreateAlarm method for different types of alarms.
Blog: lucd.info Twitter: @LucD22 Co-author PowerCLI Reference
Any update ?
Luc,
The script is fantastic..
But how to get the values of "VMware.Vim.MetricAlarmExpression" "VMware.Vim.MetricAlarmExpression.Metric.CounterId" and "VMware.Vim.EventAlarmExpression.eventTypeId" for different tasks, in runtime ..?
Beacuse i'm trying to write a general purpose function to create both Event & Metric alarms from an XML given below or a CSV ..?
<alarm><name> </name> # name for the alarm<description> </description> # description for the alarm<enabled> </enabled> # true, false<monitor></monitor> # Hosts,Clusters,Datacenters, Datastores,vDS,dPG,dClusters,vC<type> </type> # condition, event<range></range><frequency></frequency><triggers condition = "or"> # or/and<trigger><type>VMCpuUsage</type> # VmNetworkUsage/VMHeartbeat/VM state<condition>Is above</condition> # is above / is below<warning>70</warning> # 10-100 [x10]<wc_length>5</w_length> # 5-60 [x5];0;30;1;2<alert>90</alert> # 10-100 [x10]<ac_lenght>5</ac_lenght> # 5-60 [x5];0;30;1;2</trigger><trigger><type>VmNetworkUsage</type> # VMCpuUsage/VMHeartbeat/VM state<condition>Is above</condition> # is above / is below<warning>80</warning> # 10-100 [x10]<wc_length>5</w_length> # 5-60 [x5];0;30;1;2<alert>90</alert> # 10-100 [x10]<ac_lenght>5</ac_lenght> # 5-60 [x5];0;30;1;2</trigger><triggers><action><action>PowerOffVM</action> # powerOnVM/migrateVM/resetVM<change repeat='y'>Y2R<change> # G2Y/Y2R/R2Y/Y2G ; repeat -> y/n<action></alarm>
Is it possible to do that ..?
--Georgey
Yes, I think so.
It will be a matter of mapping the attribute values from your XML file to the matching metrics and/or events.
Once you have that mapping, you can automate the retrieval of the metricId and the eventTypeId.
In both my posts I gave scripts to retrieve those values.
Blog: lucd.info Twitter: @LucD22 Co-author PowerCLI Reference