I am trying create an alarm that's basically a copy of an existing vSphere alarm that alerts you when a datastore has reached a certain percentage of disk space used. This will be created in multiple folders on each datastore in different datacenters. I found some information online, I've been looking over it, and I understand the basics of what the scripts are doing, but I can't seem to make it fit into what I need.
When an alarm is manually created, at least the one that I want, I just need a name and a trigger with the trigger type, but the examples that I have seen used an event under the Triggers tab. I've tried to decipher the API/SDK documentation but I'm out of my league. So far, I have this:
$alarmMgr = Get-View AlarmManager
# Create AlarmSpec object
$alarm = New-Object VMware.Vim.AlarmSpec
$alarm.Name = "TestDSAlarm"
$alarm.Description = "Datastore Alarm usage"
$alarm.Enabled = $TRUE
Now I need a trigger, and the option to send the email when the alarm changes. Is there a good reference for me to look this up? Any help is appreciated. Also, how in the heck do I space my paragraphs on this forum now? Everything is all together even though I have carriage returns in my post.