<?xml version="1.0" encoding="UTF-8"?><rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:wfw="http://wellformedweb.org/CommentAPI/"
	xmlns:dc="http://purl.org/dc/elements/1.1/"
	xmlns:atom="http://www.w3.org/2005/Atom"
	xmlns:sy="http://purl.org/rss/1.0/modules/syndication/"
	xmlns:slash="http://purl.org/rss/1.0/modules/slash/"
	>

<channel>
	<title>Alarm Archives - LucD notes</title>
	<atom:link href="https://www.lucd.info/tag/alarm/feed/" rel="self" type="application/rss+xml" />
	<link>https://www.lucd.info/tag/alarm/</link>
	<description>My PowerShell ramblings</description>
	<lastBuildDate>Wed, 08 Apr 2020 10:22:28 +0000</lastBuildDate>
	<language>en-US</language>
	<sy:updatePeriod>
	hourly	</sy:updatePeriod>
	<sy:updateFrequency>
	1	</sy:updateFrequency>
	<generator>https://wordpress.org/?v=6.9</generator>

<image>
	<url>https://www.lucd.info/wp-content/uploads/2018/12/cropped-120px-Tibetan_Dharmacakra-32x32.png</url>
	<title>Alarm Archives - LucD notes</title>
	<link>https://www.lucd.info/tag/alarm/</link>
	<width>32</width>
	<height>32</height>
</image> 
<atom:link rel="hub" href="https://pubsubhubbub.appspot.com"/><atom:link rel="hub" href="https://pubsubhubbub.superfeedr.com"/><atom:link rel="hub" href="https://websubhub.com/hub"/>	<item>
		<title>Alarm actions &#8211; enable &#8211; disable &#8211; report</title>
		<link>https://www.lucd.info/2013/03/29/alarm-actions-enable-disable-report/</link>
					<comments>https://www.lucd.info/2013/03/29/alarm-actions-enable-disable-report/#comments</comments>
		
		<dc:creator><![CDATA[LucD]]></dc:creator>
		<pubDate>Fri, 29 Mar 2013 02:30:18 +0000</pubDate>
				<category><![CDATA[Alarm]]></category>
		<category><![CDATA[PowerShell]]></category>
		<category><![CDATA[report]]></category>
		<category><![CDATA[Action]]></category>
		<guid isPermaLink="false">http://www.lucd.info/?p=4390</guid>

					<description><![CDATA[Another post triggered by a question in the VMTN PowerCLI community. The user [&#8230;]]]></description>
										<content:encoded><![CDATA[<p>Another post triggered by a <a href="https://communities.vmware.com/message/2218951#2218951" target="_blank">question</a> in the <a href="https://communities.vmware.com/community/vmtn/server/vsphere/automationtools/powercli?view=discussions&amp;start=0" target="_blank">VMTN PowerCLI community</a>. The user wanted to know how he could create a report that showed for which vSphere entities the alarm actions were disabled.</p>
<p>To set the stage, a short overview of what this is all about. In vSphere you can, since vSphere 4, disable and enable alarm actions for all the managed entities. This option is available from the <strong>vSphere client</strong></p>
<p><a href="https://www.lucd.info/2013/03/29/alarm-actions-enable-disable-report/alarm-action-old-client/" rel="attachment wp-att-4392"><img fetchpriority="high" decoding="async" class="alignnone  wp-image-4392" alt="alarm-action-old-client" src="https://lucd.info/wp-content/uploads/2013/03/alarm-action-old-client.png" width="363" height="160" srcset="https://www.lucd.info/wp-content/uploads/2013/03/alarm-action-old-client.png 605w, https://www.lucd.info/wp-content/uploads/2013/03/alarm-action-old-client-300x132.png 300w" sizes="(max-width: 363px) 100vw, 363px" /></a></p>
<p>and from the <strong>vSphere Web client</strong>.</p>
<p><a href="https://www.lucd.info/2013/03/29/alarm-actions-enable-disable-report/alarm-action-web-client/" rel="attachment wp-att-4393"><img decoding="async" class="alignnone  wp-image-4393" alt="alarm-action-web-client" src="https://lucd.info/wp-content/uploads/2013/03/alarm-action-web-client.png" width="418" height="214" srcset="https://www.lucd.info/wp-content/uploads/2013/03/alarm-action-web-client.png 774w, https://www.lucd.info/wp-content/uploads/2013/03/alarm-action-web-client-300x153.png 300w" sizes="(max-width: 418px) 100vw, 418px" /></a></p>
<p>But how to automate these actions, and more importantly in this case, how to report on the active settings ? Like always PowerCLI to the rescue.</p>
<p><span id="more-4390"></span></p>
<h2>The script</h2>
<p></p><pre class="urvanov-syntax-highlighter-plain-tag">function Set-AlarmActionState {
&lt;#  
.SYNOPSIS  Enables or disables Alarm actions   
.DESCRIPTION The function will enable or disable
  alarm actions on a vSphere entity itself or recursively
  on the entity and all its children.
.NOTES  Author:  Luc Dekens  
.PARAMETER Entity
  The vSphere entity.
.PARAMETER Enabled
  Switch that indicates if the alarm actions should be
  enabled ($true) or disabled ($false)
.PARAMETER Recurse
  Switch that indicates if the action shall be taken on the
  entity alone or on the entity and all its children.
.EXAMPLE
  PS&gt; Set-AlarmActionState -Entity $cluster -Enabled:$true
#&gt;

  param(
    [CmdletBinding()]
    [Parameter(Mandatory=$true,ValueFromPipeline=$true)]
    [VMware.VimAutomation.ViCore.Impl.V1.Inventory.InventoryItemImpl]$Entity,
    [switch]$Enabled,
    [switch]$Recurse
  )

  begin{
    $alarmMgr = Get-View AlarmManager 
  }

  process{
    if($Recurse){
      $objects = @($Entity)
      $objects += Get-Inventory -Location $Entity
    }
    else{
      $objects = $Entity
    }
    $objects | %{
      $alarmMgr.EnableAlarmActions($_.Extensiondata.MoRef,$Enabled)
    }
  }
}

function Get-AlarmActionState {
&lt;#  
.SYNOPSIS  Returns the state of Alarm actions.    
.DESCRIPTION The function will return the state of the
  alarm actions on a vSphere entity or on the the entity
  and all its children
.NOTES  Author:  Luc Dekens  
.PARAMETER Entity
  The vSphere entity.
.PARAMETER Recurse
  Switch that indicates if the state shall be reported for
  the entity alone or for the entity and all its children.
.EXAMPLE
  PS&gt; Get-AlarmActionState -Entity $cluster -Recurse:$true
#&gt;

  param(
    [CmdletBinding()]
    [Parameter(Mandatory=$true,ValueFromPipeline=$true)]
    [VMware.VimAutomation.ViCore.Impl.V1.Inventory.InventoryItemImpl]$Entity,
    [switch]$Recurse = $false
  )

  process {
    $Entity = Get-Inventory -Id $Entity.Id
    if($Recurse){
      $objects = @($Entity)
      $objects += Get-Inventory -Location $Entity
    }
    else{
      $objects = $Entity
    }

    $objects |
    Select Name,
    @{N=&quot;Type&quot;;E={$_.GetType().Name.Replace(&quot;Impl&quot;,&quot;&quot;).Replace(&quot;Wrapper&quot;,&quot;&quot;)}},
    @{N=&quot;Alarm actions enabled&quot;;E={$_.ExtensionData.alarmActionsEnabled}}
  }
}</pre><p></p>
<h4>Annotations</h4>
<p><strong>Line 23</strong>: We declare the Entity parameter as a base Inventory  object. That way you can pass all types of vSphere entities to the function.</p>
<p><strong>Line 33-39,71-77</strong>: In the <strong>$objects</strong> variable the function collects all the entities involved. In case <strong>Recurse</strong> is True, all the child entities are obtained through the <a href="https://www.vmware.com/support/developer/PowerCLI/PowerCLI51R2/html/Get-Inventory.html" target="_blank">Get-Inventory</a> cmdlet.</p>
<p><strong>Line 41</strong>: The function calls the <a href="https://pubs.vmware.com/vsphere-51/topic/com.vmware.wssdk.apiref.doc/vim.alarm.AlarmManager.html#setAlarmActionsEnabled" target="_blank">EnableAlarmActions</a> method to change the alarm actions state of each entity. The value of the Enabled switch determines if the alarm actions will be enabled or disabled.</p>
<p><strong>Line 70</strong>: This line makes sure we have the latest situation for the entity. Remember that the objects PowerCLI produces are not updated automatically when something changes in the entity.</p>
<p><strong>Line 81</strong>: To make the Type property a bit more readable, the Impl and Wrapper suffixes are removed.</p>
<h2>Sample usage</h2>
<p>The Get-AlarmActionState function is quite easy to use. In the first example we will ask for the state of the alarms on a cluster</p>
<p></p><pre class="urvanov-syntax-highlighter-plain-tag">$cluster = Get-Cluster Cluster1
Get-AlarmActionState -Entity $cluster -Recurse:$false</pre><p></p>
<p>The result is displayed on the console as follows.</p>
<p><a href="https://www.lucd.info/2013/03/29/alarm-actions-enable-disable-report/alarm-action-report-2/" rel="attachment wp-att-4398"><img decoding="async" class="alignnone  wp-image-4398" alt="alarm-action-report-2" src="https://lucd.info/wp-content/uploads/2013/03/alarm-action-report-2.png" width="502" height="58" srcset="https://www.lucd.info/wp-content/uploads/2013/03/alarm-action-report-2.png 628w, https://www.lucd.info/wp-content/uploads/2013/03/alarm-action-report-2-300x34.png 300w" sizes="(max-width: 502px) 100vw, 502px" /></a></p>
<p>The function can also be used in a pipeline construct. The following lines will do exactly the same as the previous example.</p>
<p></p><pre class="urvanov-syntax-highlighter-plain-tag">Get-Cluster Cluster1 |
Get-AlarmActionState -Recurse:$false</pre><p></p>
<p>To change the state of the alarm actions, we can use the Set-AlarmActionState function. The following example will disable the alarm actions on Cluster1 and all its children. To confirm the change, the samepl calls the Get-AlarmActionState function to display the state.</p>
<p></p><pre class="urvanov-syntax-highlighter-plain-tag">$cluster = Get-Cluster Cluster1
$cluster | Set-AlarmActionState -Enabled:$false -Recurse:$true
$cluster | Get-AlarmActionState -Recurse:$true</pre><p></p>
<p>In the console output we can see that the state of the alarm actions has effectively been changed. And this for the cluster and all its child entities.</p>
<p><a href="https://www.lucd.info/2013/03/29/alarm-actions-enable-disable-report/alarm-action-report/" rel="attachment wp-att-4399"><img loading="lazy" decoding="async" class="alignnone  wp-image-4399" alt="alarm-action-report" src="https://lucd.info/wp-content/uploads/2013/03/alarm-action-report.png" width="507" height="125" srcset="https://www.lucd.info/wp-content/uploads/2013/03/alarm-action-report.png 634w, https://www.lucd.info/wp-content/uploads/2013/03/alarm-action-report-300x73.png 300w" sizes="auto, (max-width: 507px) 100vw, 507px" /></a></p>
<p>Another vSphere feature we can now use in our automation scripts.<br />
Enjoy !</p>
]]></content:encoded>
					
					<wfw:commentRss>https://www.lucd.info/2013/03/29/alarm-actions-enable-disable-report/feed/</wfw:commentRss>
			<slash:comments>40</slash:comments>
		
		
			</item>
		<item>
		<title>Who acknowledged that alarm ?</title>
		<link>https://www.lucd.info/2011/06/27/who-acknowledged-that-alarm/</link>
					<comments>https://www.lucd.info/2011/06/27/who-acknowledged-that-alarm/#comments</comments>
		
		<dc:creator><![CDATA[LucD]]></dc:creator>
		<pubDate>Mon, 27 Jun 2011 19:39:43 +0000</pubDate>
				<category><![CDATA[Alarm]]></category>
		<category><![CDATA[PowerShell]]></category>
		<category><![CDATA[Acknowledge]]></category>
		<category><![CDATA[PowerCLI]]></category>
		<category><![CDATA[SDK]]></category>
		<guid isPermaLink="false">http://www.lucd.info/?p=3350</guid>

					<description><![CDATA[Sometimes a solution to a problem is just staring you in the face. [&#8230;]]]></description>
										<content:encoded><![CDATA[<p>Sometimes a solution to a problem is just staring you in the face.<br />
While writing the PowerCLI book, I spent quite a bit of time on how to find which user acknowledged an alarm.<br />
Today <a href="https://www.ntpro.nl/blog/" target="_blank">Eric &#8220;Scoop&#8221; Sloof</a> launched the same question on Twitter. While I thought it was not possible, based on my past investigations, I decided to have a second look.</p>
<p>And of course now I found in a matter of minutes what had cost me fruitless hours before.</p>
<p><span id="more-3350"></span></p>
<p>While pondering the problem I realised that the acknowledgement couldn&#8217;t be stored in the Alarm itself. So I decided to have another look at the object on which the Alarm was defined.</p>
<p>The alarm I looked at was the infamous <a href="https://kb.vmware.com/selfservice/microsites/search.do?language=en_US&amp;cmd=displayKC&amp;externalId=1020651">Non-VI workload detected on the datastore.</a></p>
<p>The acknowledgement info is stored under the <strong>DeclaredAlarmState</strong> property of the <a href="https://www.vmware.com/support/developer/vc-sdk/visdk41pubs/ApiReference/vim.ManagedEntity.html" target="_blank">ManagedEntity</a> object.</p>
<p>The following little script will look at all datastores and list those where the alarm has been acknowledged.</p>
<p></p><pre class="urvanov-syntax-highlighter-plain-tag">foreach($ds in Get-Datastore){
	$ds.ExtensionData.DeclaredAlarmState | where {$_.Acknowledged} | `
		Select @{N=&quot;Datastore&quot;;E={$ds.Name}},
			@{N=&quot;Alarm&quot;;E={(Get-View -Id $_.Alarm).Info.Name}},
			@{N=&quot;Acknowledged By&quot;;E={$_.AcknowledgedByUser}},
			@{N=&quot;Time&quot;;E={$_.AcknowledgedTime}}
}</pre><p></p>
<p>This produces output like this (provided you acknowledged the alarm on some datastores of course).</p>
<p><a href="https://lucd.info/wp-content/uploads/2011/06/ack.png"><img loading="lazy" decoding="async" class="alignnone size-full wp-image-3354" title="ack" src="https://lucd.info/wp-content/uploads/2011/06/ack.png" alt="" width="571" height="44" srcset="https://www.lucd.info/wp-content/uploads/2011/06/ack.png 815w, https://www.lucd.info/wp-content/uploads/2011/06/ack-300x23.png 300w" sizes="auto, (max-width: 571px) 100vw, 571px" /></a></p>
<p>The example script only showed how to retrieve acknowledgements for datastores, but since the <strong>DeclaredAlarmState</strong> property<strong><br />
</strong> belongs to the <a href="https://www.vmware.com/support/developer/vc-sdk/visdk41pubs/ApiReference/vim.ManagedEntity.html" target="_blank">ManagedEntity</a> object, you can use this logic for any vSphere object.<br />
Thanks to <a href="https://twitter.com/#!/esloof" target="_blank">Eric</a> and <a href="https://twitter.com/#!/lamw" target="_blank">William</a> for making me have a 2nd look at this.</p>
]]></content:encoded>
					
					<wfw:commentRss>https://www.lucd.info/2011/06/27/who-acknowledged-that-alarm/feed/</wfw:commentRss>
			<slash:comments>3</slash:comments>
		
		
			</item>
		<item>
		<title>Alarms &#8211; Moving them around</title>
		<link>https://www.lucd.info/2010/02/20/alarms-moving-them-around/</link>
					<comments>https://www.lucd.info/2010/02/20/alarms-moving-them-around/#comments</comments>
		
		<dc:creator><![CDATA[LucD]]></dc:creator>
		<pubDate>Fri, 19 Feb 2010 23:37:13 +0000</pubDate>
				<category><![CDATA[Alarm]]></category>
		<category><![CDATA[PowerCLI]]></category>
		<category><![CDATA[PowerShell]]></category>
		<guid isPermaLink="false">http://lucd.info/?p=1799</guid>

					<description><![CDATA[You should know by now that alarms are a powerful tool to help [&#8230;]]]></description>
										<content:encoded><![CDATA[<p>You should know by now that alarms are a powerful tool to help you manage and monitor your vSphere environment.  But in my opinion there is a basic operation missing.</p>
<p>There is no easy way to move an alarms from one entity to another entity. No drag-and-drop in the vSphere Client, no Move-Alarm cmdlet in PowerCLI.</p>
<p>A practical example, you have developed this fantastic new alarm and for testing purposes you had defined it on a single virtual machine. Now the tests are done and your alarm is ready for production. But there is apparently no easy way to move your new alarm to the root of your vSphere environment.</p>
<p><span id="more-1799"></span></p>
<p>Luckily we have PowerCLI and we can easily create a function to fill this gap.</p>
<h2>The script</h2>
<p>The function is called <strong>Move-Alarm</strong> and has the following syntax:</p>
<p><strong>Move-Alarm -Alarm &lt;Alarm&gt; -From &lt;ViContainer&gt; -To &lt;ViContainer[]&gt; -DeleteOriginal</strong></p>
<p>&#8211;<strong>Alarm</strong>: the MoRef of the Alarm object you want to move<br />
&#8211;<strong>From</strong>: the ViContainer from where the alarm should be moved<br />
&#8211;<strong>To:</strong> one or more ViContainer objects to which the alarm should be moved<br />
&#8211;<strong>DeleteOriginal</strong>: a switch that determines what happens with the original alarm. Default is $false</p>
<h3>Update 23/02/10</h3>
<p>While using the script I discovered that the <strong>length</strong> of the name of an alarm can not exceed <strong>80 characters</strong>. This seems to be an undocumented &#8220;feature&#8221;.</p>
<p>A second problem in the original script was that when you &#8220;move&#8221; to more than one destination, there would be an error message on the second &#8220;move&#8221;. That was because you can not have <strong>two alarms</strong> with the <strong>same name</strong> in your vCenter. The solution I used was to add the name of the destination entity as a suffix to the name of the new alarm.</p>
<p>The third problem was the <strong>Status</strong> property in each <a href="https://www.vmware.com/support/developer/vc-sdk/visdk400pubs/ReferenceGuide/vim.alarm.EventAlarmExpression.html" target="_blank">EventAlarmExpression</a> object. Since the script copies the <a href="https://www.vmware.com/support/developer/vc-sdk/visdk400pubs/ReferenceGuide/vim.alarm.AlarmInfo.html" target="_blank">AlarmInfo</a> object from the &#8220;from&#8221; alarm to the <a href="https://www.vmware.com/support/developer/vc-sdk/visdk400pubs/ReferenceGuide/vim.alarm.AlarmSpec.html" target="_blank">AlarmSpec</a> object for the &#8220;to&#8221; alarm, the Status property has to <strong>blanked out</strong> explicitly.</p>
<p></p><pre class="urvanov-syntax-highlighter-plain-tag">Set-Variable -Name alarmLength -Value 80 -Option &quot;constant&quot;

$from = Get-Folder -Name &quot;Datacenters&quot; | Get-View
$to1 = Get-Folder -Name &quot;Folder1&quot; | Get-View
$to2 = Get-Folder -Name &quot;Folder2&quot; | Get-View

function Move-Alarm{
	param($Alarm, $From, $To, [switch]$DeleteOriginal = $false)

	$alarmObj = Get-View $Alarm
	$alarmMgr = Get-View AlarmManager

	if($deleteOriginal){
		$alarmObj.RemoveAlarm()
	}
	else{
		$updateAlarm = New-Object VMware.Vim.AlarmSpec
		$updateAlarm = $alarmObj.Info
		$oldName = $alarmObj.Info.Name
		$oldState = $alarmObj.Info.Enabled
		$oldDescription = $alarmObj.Info.Description
		$suffix = &quot; (moved to &quot; + ([string]($to | %{$_.Name + &quot;,&quot;})).TrimEnd(&quot;,&quot;) + &quot;)&quot;
		if(($oldName.Length + $suffix.Length) -gt $alarmLength){
			$newName = $oldName.Substring(0, $alarmLength - $suffix.Length) + $suffix
		}
		else{
			$newName = $oldName + $suffix
		}
		$updateAlarm.Name =  $newName
		$updateAlarm.Enabled = $false
		$updateAlarm.Description += (&quot;`rOriginal name: &quot; + $oldName)
		$updateAlarm.Expression.Expression | %{
			if($_.GetType().Name -eq &quot;EventAlarmExpression&quot;){
				$_.Status = $null
				$needsChange = $true
			}
		}

		$alarmObj.ReconfigureAlarm($updateAlarm)

		$alarmObj.Info.Name = $oldName
		$alarmObj.Info.Enabled = $oldState
		$alarmObj.Info.Description = $oldDescription
	}

	$newAlarm = New-Object VMware.Vim.AlarmSpec
	$newAlarm = $alarmObj.Info

	$oldName = $alarmObj.Info.Name
	$oldDescription = $alarmObj.Info.Description

	foreach($destination in $To){
		if($To.Count -gt 1){
			$suffix = &quot; (&quot; + $destination.Name + &quot;)&quot;
			if(($oldName.Length + $suffix.Length) -gt $alarmLength){
				$newName = $oldName.Substring(0, $alarmLength - $suffix.Length) + $suffix
			}
			else{
				$newName = $oldName + $suffix
			}
			$newAlarm.Name = $newName
			$newAlarm.Description += (&quot;`rOriginal name: &quot; + $oldName)
		}
		$newAlarm.Expression.Expression | %{
			if($_.GetType().Name -eq &quot;EventAlarmExpression&quot;){
				$_.Status = $null
				$needsChange = $true
			}
		}

		$alarmMgr.CreateAlarm($destination.MoRef,$newAlarm)
		$newAlarm.Name = $oldName
		$newAlarm.Description = $oldDescription
	}
}

$alarmMgr = Get-View AlarmManager

$alarms = $alarmMgr.GetAlarm($from.MoRef)
$alarms | % {
	Move-Alarm -Alarm $_ -From (Get-View $_) -To $to1,$to2 -DeleteOriginal:$false
}</pre><p></p>
<h4>Annotations</h4>
<p><strong>Line 1</strong>: The maximum length of the name of an Alarm defined as a constant.</p>
<p><strong>Line 3-5</strong>: Variables that will be used later on in the script as parameters to the function. In the sample I&#8217;m moving all alarms from the vCenter root (hidden entity &#8220;Datacenters&#8221;) to two folders called &#8220;Folder1&#8221; and &#8220;Folder2&#8221;</p>
<p><strong>Line 8</strong>: Note that the function doesn&#8217;t use strongly types parameters for the -From and -To parameters. This is because the ViObjects on which alarms can be defined can be of several types (Datacenter, Folder, HostSystem&#8230;). This also allows to pass an array of ViObjects for the -To parameter.</p>
<p><strong>Line 14</strong>: If the -DeleteOriginal switch is set to $true, the original alarm will be deleted.</p>
<p><strong>Line 17-35</strong>: If the -DeleteOriginal switch is set to $false the original Alarm will be kept but it will be renamed since there can not be multiple alarms with the same name.</p>
<p><strong>Line 24,48</strong>: If the length of name with the suffix exceeds 80 characters, the script will remove sufficient characters from the original alarmname to be able to add the suffix.</p>
<p><strong>Line 29</strong>: If the original alarm is kept it will be renamed. The original will get a suffix &#8220;(moved to &lt;dest&gt;)&#8221;</p>
<p><strong>Line 30</strong>: If the original alarm is kept it will be &#8220;disabled&#8221;.</p>
<p><strong>Line 31,54</strong>: The script adds the original alarmname to the Description field.</p>
<p><strong>Line 32-37,64-69</strong>: Since the script copies the AlarmSpec object from the original alarm, the Status field for all the EventAlarmExpression objects needs to blanked out.</p>
<p><strong>Line 52</strong>: The -To parameter is handled in a foreach loop since the function allows more than one destination. The function can be used as a 1-to-n move in this case.</p>
<p><strong>Line 80-81</strong>: A sample use case of the Move-Alarm function. All Alarms defined in the root of the vCenter will be &#8220;moved&#8221; to &#8220;Folder1&#8221; and &#8220;Folder2&#8221;. The original Alarm will not be deleted but it will be renamed and disabled.</p>
<h2>Samples</h2>
<p>Before the run of the above sample use of the script, the alarms defined on the vCenter root look like this.</p>
<p><a href="https://lucd.info/wp-content/uploads/2010/02/move-alarm-1.png"><img loading="lazy" decoding="async" class="alignnone size-full wp-image-1813" title="move-alarm-1" src="https://lucd.info/wp-content/uploads/2010/02/move-alarm-1.png" alt="" width="552" height="73" srcset="https://www.lucd.info/wp-content/uploads/2010/02/move-alarm-1.png 690w, https://www.lucd.info/wp-content/uploads/2010/02/move-alarm-1-300x39.png 300w" sizes="auto, (max-width: 552px) 100vw, 552px" /></a></p>
<p>After the first call of the Move-Alarm function the first alarm has been changed and disabled.</p>
<p><a href="https://lucd.info/wp-content/uploads/2010/02/move-alarm-2.png"><img loading="lazy" decoding="async" class="alignnone size-full wp-image-1814" title="move-alarm-2" src="https://lucd.info/wp-content/uploads/2010/02/move-alarm-2.png" alt="" width="550" height="72" srcset="https://www.lucd.info/wp-content/uploads/2010/02/move-alarm-2.png 687w, https://www.lucd.info/wp-content/uploads/2010/02/move-alarm-2-300x39.png 300w" sizes="auto, (max-width: 550px) 100vw, 550px" /></a></p>
<p>And on both target folders the alarm has been created as this screenshot from the alarms on Folder1 shows.</p>
<p><a href="https://lucd.info/wp-content/uploads/2010/02/move-alarm-31.png"><img loading="lazy" decoding="async" class="alignnone size-full wp-image-1834" title="move-alarm-3" src="https://lucd.info/wp-content/uploads/2010/02/move-alarm-31.png" alt="" width="497" height="86" srcset="https://www.lucd.info/wp-content/uploads/2010/02/move-alarm-31.png 621w, https://www.lucd.info/wp-content/uploads/2010/02/move-alarm-31-300x51.png 300w" sizes="auto, (max-width: 497px) 100vw, 497px" /></a></p>
<p>This is a rather simple function but it can be quite useful at times. I hope it can be of use to some of you.</p>
]]></content:encoded>
					
					<wfw:commentRss>https://www.lucd.info/2010/02/20/alarms-moving-them-around/feed/</wfw:commentRss>
			<slash:comments>27</slash:comments>
		
		
			</item>
		<item>
		<title>Alarms &#8211; Cody&#8217;s Abandon Ship</title>
		<link>https://www.lucd.info/2010/01/26/alarms-codys-abandon-ship/</link>
					<comments>https://www.lucd.info/2010/01/26/alarms-codys-abandon-ship/#comments</comments>
		
		<dc:creator><![CDATA[LucD]]></dc:creator>
		<pubDate>Tue, 26 Jan 2010 18:47:26 +0000</pubDate>
				<category><![CDATA[Alarm]]></category>
		<category><![CDATA[event]]></category>
		<category><![CDATA[PowerShell]]></category>
		<category><![CDATA[SDK]]></category>
		<category><![CDATA[vSphere]]></category>
		<category><![CDATA[PowerCLI]]></category>
		<guid isPermaLink="false">http://lucd.info/?p=1624</guid>

					<description><![CDATA[Yesterday, Cody published on his Professional VMware blog an excellent article, called vSphere [&#8230;]]]></description>
										<content:encoded><![CDATA[<p>Yesterday, <a href="https://twitter.com/cody_bunch" target="_blank" rel="noopener noreferrer">Cody</a> published on his <a href="https://professionalvmware.com/" target="_blank" rel="noopener noreferrer">Professional VMware</a> blog an excellent article, called <a href="http://professionalvmware.com/2010/01/vsphere-host-died-abandon-ship-vsphere-vcenter-alarms-actions/" target="_blank" rel="noopener noreferrer">vSphere Host Died Abandon Ship! – vSphere vCenter Alarms &amp; Actions</a>.</p>
<p>The article shows a very elegant solution how to move your guests to &#8220;safer havens&#8221;, the moment one of the hosts in the cluster starts experiencing hardware problems.<br />
The elegance of Cody&#8217;s solution is that he uses <strong>maintenance mode</strong> to force <strong>vMotion</strong> on all the powered-on guests on the host that experiences HW problems.</p>
<p><span id="more-1624"></span>The condition for the solution to work is of course that the host needs to be a node in a <strong>DRS</strong>-enabled cluster where the <strong>Automation Level</strong> is set to <strong>Fully automated</strong>.</p>
<p>Since I thought that this was a good example of some of the alarm-related posts I did in the past, I created a script so you can automate the creation of Cody&#8217;s alarm.</p>
<p></p><pre class="urvanov-syntax-highlighter-plain-tag">$dcName = &quot;MyDatacenter&quot;
$mailto = &quot;lucd@lucd.info&quot;

$alarmMgr = Get-View AlarmManager
$entity = Get-Datacenter $dcName | Get-View

# AlarmSpec
$alarm = New-Object VMware.Vim.AlarmSpec
$alarm.Name = &quot;Generic Host Health Alert&quot;
$alarm.Description = &quot;When host reports HW health, place host in maintenance mode&quot;
$alarm.Enabled = $TRUE

$alarm.action = New-Object VMware.Vim.GroupAlarmAction

# Action 1 - Send email
$trigger1 = New-Object VMware.Vim.AlarmTriggeringAction
$trigger1.action = New-Object VMware.Vim.SendEmailAction
$trigger1.action.ToList = $mailTo
$trigger1.action.Subject = &quot;HW Health - Set host in maintenance mode&quot;
$trigger1.Action.CcList = &quot;&quot;
$trigger1.Action.Body = &quot;&quot;

# Action 2 - Enter maintenance mode
$trigger2 = New-Object VMware.Vim.AlarmTriggeringAction
$trigger2.action = New-Object VMware.Vim.MethodAction
$trigger2.action.Name = &quot;EnterMaintenanceMode_Task&quot;

# Action 2 - Arguments
$arg1 = New-Object VMware.Vim.MethodActionArgument
# timeout
$arg1.value = 0
# evacuatePoweredOffVms
$arg2 = New-Object VMware.Vim.MethodActionArgument
$arg2.value = $false

$trigger2.action.argument += $arg1
$trigger2.action.argument += $arg2

# Transition - yellow --&gt; red
$trans = New-Object VMware.Vim.AlarmTriggeringActionTransitionSpec
$trans.StartState = &quot;yellow&quot;
$trans.FinalState = &quot;red&quot;

$trigger1.TransitionSpecs += $trans
$trigger2.TransitionSpecs += $trans

$alarm.action.action += $trigger1
$alarm.action.action += $trigger2

# Expression - Hardware Health Changed
$expression = New-Object VMware.Vim.EventAlarmExpression
$expression.EventType = &quot;EventEx&quot;
$expression.eventTypeId = &quot;com.vmware.vc.cim.CIMGroupHealthStateChanged&quot;
$expression.objectType = &quot;HostSystem&quot;
$expression.status = &quot;red&quot;

$alarm.expression = New-Object VMware.Vim.OrAlarmExpression
$alarm.expression.expression += $expression

$alarm.setting = New-Object VMware.Vim.AlarmSetting
$alarm.setting.reportingFrequency = 0
$alarm.setting.toleranceRange = 0

# Create alarm.
$alarmMgr.CreateAlarm($entity.MoRef, $alarm)</pre><p></p>
<h4>Annotations</h4>
<p><strong>Line 1</strong>: The script creates the alarm on a datacenter but you can easily replace that by any object that supports alarm definitions.</p>
<p><strong>Line 26</strong>: When the alarm is fired this action will make a call to the <a href="https://www.vmware.com/support/developer/vc-sdk/visdk400pubs/ReferenceGuide/vim.HostSystem.html#enterMaintenanceMode" target="_blank" rel="noopener noreferrer">EnterMaintenanceMode_Task</a>.</p>
<p><strong>Line 29-35</strong>: The <a href="https://www.vmware.com/support/developer/vc-sdk/visdk400pubs/ReferenceGuide/vim.HostSystem.html#enterMaintenanceMode" target="_blank" rel="noopener noreferrer">EnterMaintenanceMode_Task</a> method requires two arguments. For the first argument, called <strong>timeout</strong>, we specify 0 (zero) which indicates there is no timeout. The second argument, called <strong>evacuatePoweredOffVms</strong>, is a Boolean value that indicates if powered-off guests should also be migrated. We pass $false, meaning that the powered-off guest shall not be migrated.</p>
<p>Line <strong>52-56</strong>: See my earlier post, called <a href="https://lucd.info/?p=1058" target="_blank" rel="noopener noreferrer">Alarm expressions – Part 2 : Event alarms</a>, for more information on how to list the available events.</p>
<p>The result of the script is a new alarm identical to the one Cody created in the vSphere client.</p>
<p><a href="https://lucd.info/wp-content/uploads/2010/01/cody-alarm-1.png"><img loading="lazy" decoding="async" class="alignnone size-full wp-image-1632" title="cody-alarm-1" src="https://lucd.info/wp-content/uploads/2010/01/cody-alarm-1.png" alt="" width="587" height="257" srcset="https://www.lucd.info/wp-content/uploads/2010/01/cody-alarm-1.png 734w, https://www.lucd.info/wp-content/uploads/2010/01/cody-alarm-1-300x131.png 300w" sizes="auto, (max-width: 587px) 100vw, 587px" /></a></p>
<p><a href="https://lucd.info/wp-content/uploads/2010/01/cody-alarm-2.png"><img loading="lazy" decoding="async" class="alignnone size-full wp-image-1633" title="cody-alarm-2" src="https://lucd.info/wp-content/uploads/2010/01/cody-alarm-2.png" alt="" width="589" height="141" srcset="https://www.lucd.info/wp-content/uploads/2010/01/cody-alarm-2.png 736w, https://www.lucd.info/wp-content/uploads/2010/01/cody-alarm-2-300x71.png 300w" sizes="auto, (max-width: 589px) 100vw, 589px" /></a></p>
<p><a href="https://lucd.info/wp-content/uploads/2010/01/cody-alarm-3.png"><img loading="lazy" decoding="async" class="alignnone size-full wp-image-1634" title="cody-alarm-3" src="https://lucd.info/wp-content/uploads/2010/01/cody-alarm-3.png" alt="" width="588" height="162" srcset="https://www.lucd.info/wp-content/uploads/2010/01/cody-alarm-3.png 735w, https://www.lucd.info/wp-content/uploads/2010/01/cody-alarm-3-300x82.png 300w" sizes="auto, (max-width: 588px) 100vw, 588px" /></a></p>
<p>With this script you can now include the creation of this alarm in your automation process.</p>
<p>And the script has also shown that it is more flexible than the vSphere client. Try for example changing the parameters of the method (in this case <a href="https://www.vmware.com/support/developer/vc-sdk/visdk400pubs/ReferenceGuide/vim.HostSystem.html#enterMaintenanceMode" target="_blank" rel="noopener noreferrer">EnterMaintenanceMode_Task</a>) you use in the Actions.</p>
]]></content:encoded>
					
					<wfw:commentRss>https://www.lucd.info/2010/01/26/alarms-codys-abandon-ship/feed/</wfw:commentRss>
			<slash:comments>2</slash:comments>
		
		
			</item>
		<item>
		<title>Alarms &#8211; Adding an action</title>
		<link>https://www.lucd.info/2010/01/17/alarms-adding-an-action/</link>
					<comments>https://www.lucd.info/2010/01/17/alarms-adding-an-action/#comments</comments>
		
		<dc:creator><![CDATA[LucD]]></dc:creator>
		<pubDate>Sun, 17 Jan 2010 18:08:38 +0000</pubDate>
				<category><![CDATA[Alarm]]></category>
		<category><![CDATA[PowerCLI]]></category>
		<category><![CDATA[PowerShell]]></category>
		<category><![CDATA[vSphere]]></category>
		<guid isPermaLink="false">http://lucd.info/?p=1533</guid>

					<description><![CDATA[An interesting question on Alarms arrived in my mailbox recently. Charlie wanted to [&#8230;]]]></description>
										<content:encoded><![CDATA[<p>An interesting question on <strong>Alarms</strong> arrived in my mailbox recently. <strong>Charlie</strong> wanted to know if it was possible to <strong>add an action</strong> to a selected set of the alarms he has defined in his vCenter.</p>
<p>The current <a href="https://communities.vmware.com/community/vmtn/vsphere/automationtools/windows_toolkit?view=overview" target="_blank" rel="noopener noreferrer">PowerCLI</a> build (version 4 update 1 &#8211; build 208462) unfortunately has no cmdlets to work with alarms. There are some alarm-related cmdlets available in the <a href="https://vitoolkitextensions.codeplex.com/" target="_blank" rel="noopener noreferrer">VI Toolkit for Windows Community Extensions</a>. But none of these provides the functionality Charlie wanted to have.</p>
<p><span id="more-1533"></span></p>
<p>To start with alarm action maintenance, you should be able to report on what is currently defined in the vCenter.</p>
<p>As a reminder, the following types of alarm actions are available in the current vSphere version.</p>
<ol>
<li>Create a task</li>
<li>Execute a &#8220;method&#8221; on a specific entity</li>
<li>Run a script</li>
<li>Send an email</li>
<li>Send an SNMP trap</li>
</ol>
<p>An alarm can have one or more of the above defined.</p>
<h3>Inventory</h3>
<p>The following script produces a <strong>CLIXML</strong> file containing all the existing alarms and for each of them a selection of their properties, including the action(s) that are defined.</p>
<p>Why CLIXML and not to a plain XML or CSV file ? The answer is simple: &#8220;<strong>structure</strong>&#8220;.</p>
<p>While a CSV file is handy to export object that all have the same layout, it&#8217;s quite cumbersome to export objects that have varying content. Same is valid for the <strong>ConvertTo-Xml</strong> cmdlet that came with <strong>PowerShell v2</strong>.</p>
<p>Since an alarm can have one or more actions of different types (see above), the easiest <a href="https://en.wikipedia.org/wiki/Serialization" target="_blank" rel="noopener noreferrer">serialisation</a> solution was <strong>CLIXML</strong> and to use the built-in <strong>Export-CliXML</strong> cmdlet.</p>
<p>One of the disadvantages of the CLIXML format; it&#8217;s not obvious for a user to read this type of XML file !</p>
<p></p><pre class="urvanov-syntax-highlighter-plain-tag">function Get-AlarmAction{
	param($action)

	$list = @()
	if($action -ne $null){
		switch($action.GetType().Name){
			&quot;GroupAlarmAction&quot;{
				$action.action | % {
					$_.Action | % {
						$list += Get-AlarmAction $_
					}
				}
			}
			&quot;CreateTaskAction&quot;{
				$list += New-Object PSObject -Property @{
					Type = $_
					TaskTypeId = $action.taskTypeId
					Cancelable = %action.Cancelable
				}
			}
			&quot;MethodAction&quot;{
				$list += New-Object PSObject -Property @{
					Type = $_
					Argument = $action.argument
					Name = $action.name
				}
			}
			&quot;RunScriptAction&quot;{
				$list += New-Object PSObject -Property @{
					Type = $_
					Script = $action.script
				}
			}
			&quot;SendEmailAction&quot;{
				$list += New-Object PSObject -Property @{
					Type = $_
					Body = $action.taskTypeId
					ccList = $action.Cancelable
					Subject = $action.Subject
					toList = $action.toList
				}
			}
			&quot;SendSNMPAction&quot;{
				$list += New-Object PSObject -Property @{
					Type = $_
				}
			}
		}
	}
	$list
}

$alarmMgr = Get-View AlarmManager

$alarms = $alarmMgr.GetAlarm($null)
$report = @()
$alarms | % {
	$alarm = Get-View $_
	$report += New-Object PSObject -Property @{
		Name = $alarm.Info.Name
		Description = $alarm.Info.Description
		Entity = (Get-View $alarm.Info.Entity).Name
		Enabled = $alarm.Info.Enabled
		Action = Get-AlarmAction $alarm.Info.Action
	}
}

$report | Export-Clixml &quot;C:\Alarm-actions.xml&quot; -NoClobber</pre><p></p>
<h4>Annotations</h4>
<p><strong>Line 1</strong>: This function is called recursively (for the <a href="https://www.vmware.com/support/developer/vc-sdk/visdk400pubs/ReferenceGuide/vim.alarm.GroupAlarmAction.html#field_detail" target="_blank" rel="noopener noreferrer">GroupAlarmAction</a>). All actions will be returned in an array of PSObjects.</p>
<p><strong>Line 6</strong>: This switch handles all possibilities that can be found in the Action property.</p>
<p><strong>Line 7-13</strong>: A <a href="https://www.vmware.com/support/developer/vc-sdk/visdk400pubs/ReferenceGuide/vim.alarm.GroupAlarmAction.html#field_detail" target="_blank" rel="noopener noreferrer">GroupAlarmAction</a> can contain one or more of the other &#8220;basic&#8221; actions. This case loops through each of them and calls the <strong>Get-AlarmAction</strong> function recursively.</p>
<p><strong>Line 14-47</strong>: Handles each of the &#8220;base&#8221; actions and stores the specific properties for each of them in a PSObject. Note that the <strong>New-Object</strong> format that is used here is only valid in <strong>PowerShell v2 RTM</strong>.</p>
<p><strong>Line 55</strong>: If the <strong>GetAlarm</strong> method is called with the <strong>$null</strong> parameter it will return all alarms defined in the vCenter.</p>
<p><strong>Line 68</strong>: The report with all the alarms is saved to an XML file. The -NoClobber parameter makes sure n existing file is not overwritten.</p>
<p>As you can notice from the following extract, the content of the file is rather hard to read if you&#8217;re not used to the CLIXML format..</p>
<p><a href="https://lucd.info/wp-content/uploads/2010/01/alarm-action-xml2.png"><img loading="lazy" decoding="async" class="alignnone size-full wp-image-1553" title="alarm-action-xml" src="https://lucd.info/wp-content/uploads/2010/01/alarm-action-xml2.png" alt="" width="628" height="362" srcset="https://www.lucd.info/wp-content/uploads/2010/01/alarm-action-xml2.png 785w, https://www.lucd.info/wp-content/uploads/2010/01/alarm-action-xml2-300x172.png 300w" sizes="auto, (max-width: 628px) 100vw, 628px" /></a></p>
<p>The file was opened with <a href="http://www.wmhelp.com/xmlpad3.htm" target="_blank" rel="noopener noreferrer">XMLPad</a> in the Tabular view.</p>
<h3>Quick report</h3>
<p>To get a quick listing of the file contents you can execute the following line</p>
<p></p><pre class="urvanov-syntax-highlighter-plain-tag">Import-Clixml &quot;C:\Alarm-actions.xml&quot;</pre><p></p>
<p>This will produce a listing in the console window looking like this.</p>
<p><a href="https://lucd.info/wp-content/uploads/2010/01/alarm-action-list.png"><img loading="lazy" decoding="async" class="alignnone size-full wp-image-1560" title="alarm-action-list" src="https://lucd.info/wp-content/uploads/2010/01/alarm-action-list.png" alt="" width="694" height="196" srcset="https://www.lucd.info/wp-content/uploads/2010/01/alarm-action-list.png 867w, https://www.lucd.info/wp-content/uploads/2010/01/alarm-action-list-300x84.png 300w" sizes="auto, (max-width: 694px) 100vw, 694px" /></a></p>
<p>Which is definitely more legible than the CLIXML file itself.</p>
<h3>Add an action</h3>
<p>The following script will allow you to add an action on a selected set of alarms.</p>
<p></p><pre class="urvanov-syntax-highlighter-plain-tag"># Alarms to be changed
$tgtAlarms = &quot;Test1&quot;,&quot;Test2&quot;
# $tgtAlarms = &quot;Test2&quot;

#=================================
# Uncomment one of the following actions
# Fill in the required parameters
#=================================
# New createtask action
# $actType = &quot;CreateTaskAction&quot;
# $actTaskTypeId =
# $actCancelable =
#-- -------------------------------
# New method action
# $actType = &quot;MethodAction&quot;
# $actArgument =
# $actName =
#---------------------------------
# New runscript action
# $actType = &quot;RunScriptAction&quot;
# $actScript =
#---------------------------------
# New sendmail action
$actType = &quot;SendEmailAction&quot;
$actTo = &quot;luc@lucd.info&quot;
$actCc = &quot;&quot;
$actSubject = &quot;Alarm email&quot;
$actBody = &quot;&quot;
#---------------------------------
# New sendSNMP action
# $actType = &quot;SendSNMPAction&quot;
#=================================

function Set-AlarmAction{
	param($alarm)

	switch($actType){
		&quot;CreateTaskAction&quot;{
			$trigger = New-Object VMware.Vim.AlarmTriggeringAction
			$trigger.action = New-Object VMware.Vim.CreateTaskAction
			$trigger.action.Cancelable = $actCancelable
			$trigger.action.taskTypeId = $actTaskTypeId
		}
		&quot;MethodAction&quot;{
			$trigger = New-Object VMware.Vim.AlarmTriggeringAction
			$trigger.action = New-Object VMware.Vim.MethodAction
			$trigger.action.Argument = $actArgument
			$trigger.action.Name = $actName
		}
		&quot;RunScriptAction&quot;{
			$trigger = New-Object VMware.Vim.AlarmTriggeringAction
			$trigger.action = New-Object VMware.Vim.RunScriptAction
			$trigger.action.Script = $actScript
		}
		&quot;SendEmailAction&quot;{
			$trigger = New-Object VMware.Vim.AlarmTriggeringAction
			$trigger.action = New-Object VMware.Vim.SendEmailAction
			$trigger.action.ToList = $actTo
			$trigger.action.Subject = $actSubject
			$trigger.Action.CcList = $actCc
			$trigger.Action.Body = $actBody
		}
		&quot;SendSNMPAction&quot;{
			$trigger = New-Object VMware.Vim.AlarmTriggeringAction
			$trigger.action = New-Object VMware.Vim.SendSNMPAction
		}
	}
# Transition a - yellow --&gt; red
	$transa = New-Object VMware.Vim.AlarmTriggeringActionTransitionSpec
	$transa.StartState = &quot;green&quot;
	$transa.FinalState = &quot;yellow&quot;
# Transition b - red --&gt; yellow
	$transb = New-Object VMware.Vim.AlarmTriggeringActionTransitionSpec
	$transb.StartState = &quot;yellow&quot;
	$transb.FinalState = &quot;red&quot;
	$trigger.TransitionSpecs += $transa
	$trigger.TransitionSpecs += $transb

	if($alarm.Info.Action -eq $null){
		$action = New-Object VMware.Vim.GroupAlarmAction
	}
	else{
		if($alarm.Info.Action.GetType().Name -ne &quot;GroupAlarmAction&quot;){
			$action = New-Object VMware.Vim.GroupAlarmAction
			$action.action += $alarm.Info.Action
		}
		else{
			$action = $alarm.Info.Action
		}
	}
	$action.action += $trigger

	$spec = New-Object VMware.Vim.AlarmSpec
	$spec.Action = $action
	$spec.actionFrequency = $alarm.Info.ActionFrequency
	$spec.Description = $alarm.Info.Description
	$spec.Enabled = $alarm.Info.Enabled
	$spec.Expression = $alarm.Info.Expression
	$spec.Name = $alarm.Info.Name
	$spec.Setting = $alarm.Info.Setting

	$alarm.ReconfigureAlarm($spec)
}

# Get all alarms
$alarmMgr = Get-View AlarmManager
$alarms = $alarmMgr.GetAlarm($null)

# For all selected alarms
$alarms | % {
	$alarm = Get-View $_
	if($tgtAlarms -contains $alarm.Info.Name){
		Set-AlarmAction $alarm
	}
}</pre><p></p>
<h4>Annotations</h4>
<p><strong>Line 2</strong>: The variable $tgtAlarms is an array of strings where each element is the name of an alarm where you want to add an action.</p>
<p><strong>Line 5-32</strong>: Uncomment one of the actions. This will be the action that is added to the alarms defined in $tgtAlarms.</p>
<p><strong>Line 37-67</strong>: In this switch construction the new action is set up.</p>
<p><strong>Line 68-77</strong>: The new action requires one or more triggers, in other words when will the action be executed. In the script I defined the triggers to be fired when the alarm goes from green to yellow and when the alarm goes from yellow to red. If you require other triggers change the contents of the <a href="https://www.vmware.com/support/developer/vc-sdk/visdk400pubs/ReferenceGuide/vim.alarm.AlarmTriggeringAction.html" target="_blank" rel="noopener noreferrer">AlarmTriggeringAction</a> object.</p>
<p><strong>Line 79-91</strong>: These lines make sure the new action is added in the correct place. Note that the script uses the <a href="https://www.vmware.com/support/developer/vc-sdk/visdk400pubs/ReferenceGuide/vim.alarm.GroupAlarmAction.html" target="_blank" rel="noopener noreferrer">GroupAlarmAction</a> to combine all the actions. This to avoid the problem I mentioned in <a href="https://lucd.info/?p=983" target="_blank" rel="noopener noreferrer">Alarm expressions – Part 1 : Metric alarms</a> where your alarm settings are not editable anymore in the vSphere client.</p>
<p><strong>Line 93-100</strong>: The <a href="https://www.vmware.com/support/developer/vc-sdk/visdk400pubs/ReferenceGuide/vim.alarm.AlarmSpec.html" target="_blank" rel="noopener noreferrer">AlarmSpec</a> object is set up. Except for the Action property all properties are copied from the existing alarm.</p>
<p><strong>Line 102</strong>: The <a href="https://www.vmware.com/support/developer/vc-sdk/visdk400pubs/ReferenceGuide/vim.alarm.Alarm.html#reconfigure" target="_blank" rel="noopener noreferrer">ReconfigureAlarm</a> method is used to add the new action.</p>
<p><strong>Line 105-107</strong>: Get all the defined alarms.</p>
<p><strong>Line 110-115</strong>: A simple loop to find all the alarms that were specified in the $tgtAlarms variable. For each of the specified alarms the Set-AlarmAction is called.</p>
<p>After the script is executed you will see the new action on the selected alarms.</p>
<p><a href="https://lucd.info/wp-content/uploads/2010/01/alarm-action-added.png"><img loading="lazy" decoding="async" class="alignnone size-full wp-image-1568" title="alarm-action-added" src="https://lucd.info/wp-content/uploads/2010/01/alarm-action-added.png" alt="" width="590" height="158" srcset="https://www.lucd.info/wp-content/uploads/2010/01/alarm-action-added.png 737w, https://www.lucd.info/wp-content/uploads/2010/01/alarm-action-added-300x80.png 300w" sizes="auto, (max-width: 590px) 100vw, 590px" /></a></p>
<p>Notice the triggers in the four columns on the right.</p>
]]></content:encoded>
					
					<wfw:commentRss>https://www.lucd.info/2010/01/17/alarms-adding-an-action/feed/</wfw:commentRss>
			<slash:comments>14</slash:comments>
		
		
			</item>
		<item>
		<title>Alarm expressions &#8211; Part 2 : Event alarms</title>
		<link>https://www.lucd.info/2009/11/27/alarm-expressions-part-2-event-alarms/</link>
					<comments>https://www.lucd.info/2009/11/27/alarm-expressions-part-2-event-alarms/#comments</comments>
		
		<dc:creator><![CDATA[LucD]]></dc:creator>
		<pubDate>Fri, 27 Nov 2009 07:56:15 +0000</pubDate>
				<category><![CDATA[Alarm]]></category>
		<category><![CDATA[event]]></category>
		<category><![CDATA[PowerCLI]]></category>
		<category><![CDATA[PowerShell]]></category>
		<category><![CDATA[vSphere]]></category>
		<category><![CDATA[SDK]]></category>
		<guid isPermaLink="false">http://lucd.info/?p=1058</guid>

					<description><![CDATA[In the previous part of this series (Alarm expressions &#8211; Part 1 : [&#8230;]]]></description>
										<content:encoded><![CDATA[<p>In the previous part of this series (<a href="https://lucd.info/?p=983" target="_blank">Alarm expressions &#8211; Part 1 : Metric alarms</a>) I showed how you could create alarms that are triggered when a metric crosses a watermark.</p>
<p><a href="https://www.lucd.info/2009/11/27/alarm-expressions-part-2-event-alarms/zen/" rel="attachment wp-att-1085"><img loading="lazy" decoding="async" class="aligncenter size-full wp-image-1085" title="zen" src="https://lucd.info/wp-content/uploads/2009/11/zen.gif" alt="zen" width="185" height="178" srcset="https://www.lucd.info/wp-content/uploads/2009/11/zen.gif 481w, https://www.lucd.info/wp-content/uploads/2009/11/zen-300x288.gif 300w" sizes="auto, (max-width: 185px) 100vw, 185px" /></a>In this part I will show you how to create alarms when one or more specific events occur in your vSphere environment. More specifically I will show you how to create an alarm that will fire when someone <strong>adds</strong> or <strong>removes</strong> a <strong>license</strong> from your vCenter.</p>
<p><span id="more-1058"></span></p>
<p><span style="color: #ff0000;"><strong>Warning</strong></span>: this function will <strong>not</strong> work in <strong>vCenter 4.x</strong> when you are using the builtin licensing instead of the separate License Manager. I&#8217;ll post an update soon.</p>
<p>The first step for creating alarms based on this type of triggers is to define which event(s) to use. As I showed in <a href="https://lucd.info/?p=956" target="_blank">Events, Dear Boy, Events &#8211; Part 2,</a> there are an enormous number of possible events to chose from.</p>
<p>With the CSV file from that blog entry it&#8217;s easy to find out which events, related to licensing, are available. I used the following script for this</p>
<p></p><pre class="urvanov-syntax-highlighter-plain-tag">$targetStr = &quot;license&quot;
Import-Csv &quot;C:\Events.csv&quot; -UseCulture | where {$_.Name -match $targetStr -or $_.Description -match $targetStr}</pre><p></p>
<p>From the output it is clear that I will have to use events from the <a href="https://www.vmware.com/support/developer/vc-sdk/visdk400pubs/ReferenceGuide/vim.event.EventEx.html" target="_blank">EventEx</a> type.</p>
<p><a href="https://www.lucd.info/2009/11/27/alarm-expressions-part-2-event-alarms/license-events/" rel="attachment wp-att-1065"><img loading="lazy" decoding="async" class="aligncenter size-full wp-image-1065" title="license-events" src="https://lucd.info/wp-content/uploads/2009/11/license-events.png" alt="license-events" width="969" height="237" srcset="https://www.lucd.info/wp-content/uploads/2009/11/license-events.png 1211w, https://www.lucd.info/wp-content/uploads/2009/11/license-events-300x73.png 300w, https://www.lucd.info/wp-content/uploads/2009/11/license-events-1024x250.png 1024w" sizes="auto, (max-width: 969px) 100vw, 969px" /></a></p>
<p>In the <a href="https://www.vmware.com/support/developer/vc-sdk/visdk400pubs/ReferenceGuide/vim.alarm.EventAlarmExpression.html" target="_blank">EventAlarmExpression</a> description it says that one needs to pass an <strong>eventTypeId</strong>. Unfortunately the Reference Guide doesn&#8217;t explain how to get such an eventTypeId. After some trial and error I discovered you can get that property via the <a href="https://www.vmware.com/support/developer/vc-sdk/visdk400pubs/ReferenceGuide/vim.ExtensionManager.html" target="_blank">Extensionmanager</a>. The following short script list all the extensions registered in your vSphere environment and shows their eventTypeIds.</p>
<p></p><pre class="urvanov-syntax-highlighter-plain-tag">$extMgr = Get-View ExtensionManager
$extMgr.ExtensionList | %{
if($_.EventList -ne $null){
$_.Key
$_.EventList | %{
&quot;`t&quot; + $_.EventId
}
}
}</pre><p></p>
<p>The output of this script shows what I need.</p>
<p style="text-align: left;"><a href="https://www.lucd.info/2009/11/27/alarm-expressions-part-2-event-alarms/license-events-2/" rel="attachment wp-att-1074"><img loading="lazy" decoding="async" class="aligncenter size-full wp-image-1074" title="license-events-2" src="https://lucd.info/wp-content/uploads/2009/11/license-events-2.png" alt="license-events-2" width="402" height="269" srcset="https://www.lucd.info/wp-content/uploads/2009/11/license-events-2.png 502w, https://www.lucd.info/wp-content/uploads/2009/11/license-events-2-300x200.png 300w" sizes="auto, (max-width: 402px) 100vw, 402px" /></a></p>
<p style="text-align: left;">The following script puts it all together and creates the alarm.</p>
<p></p><pre class="urvanov-syntax-highlighter-plain-tag">$dcName = &quot;MyDatacenter&quot;
$mailto = &quot;luc.dekens@lucd.info&quot;

$alarmMgr = Get-View AlarmManager
$entity = Get-Datacenter $dcName | Get-View

# AlarmSpec
$alarm = New-Object VMware.Vim.AlarmSpec
$alarm.Name = &quot;Add/remove license&quot;
$alarm.Description = &quot;Add or remove a license&quot;
$alarm.Enabled = $TRUE

# Action - Send email
$alarm.action = New-Object VMware.Vim.GroupAlarmAction

$trigger1 = New-Object VMware.Vim.AlarmTriggeringAction
$trigger1.action = New-Object VMware.Vim.SendEmailAction
$trigger1.action.ToList = $mailTo
$trigger1.action.Subject = &quot;License added/removed&quot;
$trigger1.Action.CcList = &quot;&quot;
$trigger1.Action.Body = &quot;&quot;

# Transition 1a - yellow --&gt; red
$trans1a = New-Object VMware.Vim.AlarmTriggeringActionTransitionSpec
$trans1a.StartState = &quot;yellow&quot;
$trans1a.FinalState = &quot;red&quot;

# Transition 1b - red --&gt; yellow
$trans1b = New-Object VMware.Vim.AlarmTriggeringActionTransitionSpec
$trans1b.StartState = &quot;red&quot;
$trans1b.FinalState = &quot;yellow&quot;

$trigger1.TransitionSpecs += $trans1a
$trigger1.TransitionSpecs += $trans1b

$alarm.action.action += $trigger1

# Expression 1 - License added
$expression1 = New-Object VMware.Vim.EventAlarmExpression
$expression1.EventType = $null
$expression1.eventTypeId = &quot;com.vmware.license.AddLicenseEvent&quot;
$expression1.objectType = &quot;Datacenter&quot;
$expression1.status = &quot;yellow&quot;

# Expression 2 - License removed
$expression2 = New-Object VMware.Vim.EventAlarmExpression
$expression2.EventType = $null
$expression2.eventTypeId = &quot;com.vmware.license.RemoveLicenseEvent&quot;
$expression2.objectType = &quot;Datacenter&quot;
$expression2.status = &quot;yellow&quot;

$alarm.expression = New-Object VMware.Vim.OrAlarmExpression
$alarm.expression.expression += $expression1
$alarm.expression.expression += $expression2

$alarm.setting = New-Object VMware.Vim.AlarmSetting
$alarm.setting.reportingFrequency = 0
$alarm.setting.toleranceRange = 0

# Create alarm.
$alarmMgr.CreateAlarm($entity.MoRef, $alarm)</pre><p></p>
<p>Annotations:</p>
<p>Line 40 &amp; 47: although the SDK Reference says that the <strong>eventTypeId</strong> property replaces the <strong>EventType</strong> property you have to explicitly set the EventType property to <strong>$null</strong>. Otherwise the CreateAlarm method will fail</p>
<p>You can now automate the creation of your <strong>event-driven alarms</strong>.</p>
]]></content:encoded>
					
					<wfw:commentRss>https://www.lucd.info/2009/11/27/alarm-expressions-part-2-event-alarms/feed/</wfw:commentRss>
			<slash:comments>10</slash:comments>
		
		
			</item>
		<item>
		<title>Alarm expressions &#8211; Part 1 : Metric alarms</title>
		<link>https://www.lucd.info/2009/11/24/alarm-expressions-part-1-metric-alarms/</link>
					<comments>https://www.lucd.info/2009/11/24/alarm-expressions-part-1-metric-alarms/#comments</comments>
		
		<dc:creator><![CDATA[LucD]]></dc:creator>
		<pubDate>Tue, 24 Nov 2009 18:55:45 +0000</pubDate>
				<category><![CDATA[Alarm]]></category>
		<category><![CDATA[PowerCLI]]></category>
		<category><![CDATA[PowerShell]]></category>
		<guid isPermaLink="false">http://lucd.info/?p=983</guid>

					<description><![CDATA[In a previous entry (Scripts for Yellow Bricks&#8217; advise: Thin Provisioning alarm &#38; [&#8230;]]]></description>
										<content:encoded><![CDATA[<p>In a previous entry (<a href="https://lucd.info/?p=918" target="_blank">Scripts for Yellow Bricks&#8217; advise: Thin Provisioning alarm &amp; eagerZeroedThick</a>) I showed how you could use performance metrics to fire an alarm. The <a href="https://www.vmware.com/support/developer/vc-sdk/visdk400pubs/ReferenceGuide/vim.alarm.MetricAlarmExpression.html" target="_blank">MetricAlarmExpression</a> in that script requires a <a href="https://www.vmware.com/support/developer/vc-sdk/visdk400pubs/ReferenceGuide/vim.PerformanceManager.MetricId.html" target="_blank">PerfMetricId</a> to specify which performance metric the alarm should monitor. The <strong>counterId</strong> in that object is an <strong>integer</strong> and it is perhaps not too obvious which value corresponds with which metric.</p>
<p style="text-align: center;"><a href="https://www.lucd.info/2009/11/24/alarm-expressions-part-1-metric-alarms/metric-alarm/" rel="attachment wp-att-1014"><img loading="lazy" decoding="async" class="aligncenter size-full wp-image-1014" title="metric-alarm" src="https://lucd.info/wp-content/uploads/2009/11/metric-alarm.jpg" alt="metric-alarm" width="336" height="252" srcset="https://www.lucd.info/wp-content/uploads/2009/11/metric-alarm.jpg 700w, https://www.lucd.info/wp-content/uploads/2009/11/metric-alarm-300x225.jpg 300w" sizes="auto, (max-width: 336px) 100vw, 336px" /></a></p>
<p>This blog entry shows how you can quickly get a list of permitted <strong>counterIds</strong> (and <strong>instances</strong>) for a specific entity. And it will show how to create some &#8220;impossible&#8221; alarms !</p>
<p><span id="more-983"></span>In the vSphere environment all things &#8220;performance&#8221; are managed by the <a href="https://www.vmware.com/support/developer/vc-sdk/visdk400pubs/ReferenceGuide/vim.PerformanceManager.html" target="_blank">PerformanceManager</a>. In the PerformanceManager object the perfCounter property contains a list of all the performance counters the system supports.</p>
<p>But not every entity supports every performance counter. That is why I will use the <a href="https://www.vmware.com/support/developer/vc-sdk/visdk400pubs/ReferenceGuide/vim.PerformanceManager.html#queryAvailableMetric" target="_blank">QueryAvailablePerfMetric</a> method to obtain the list of metrics for a specific entity.</p>
<p>The following script will produce a CSV file with the available metrics per entity type (cluster, host, virtual machine, datastore&#8230;) per interval.</p>
<p><span style="background-color: #ffff00;"><strong>Update September 8th 2010</strong></span>: This is a <strong>complete rewrite</strong> of the &#8220;<em>Metrics</em>&#8221; script. There was in fact no need to query the metrics for each historical interval, it was sufficient to query the metrics for &#8220;<strong>Current</strong>&#8221; (realtime) and &#8220;<strong>Summary</strong>&#8221; (historical). The new script also contains some tests which will avoid error messages when a specific entity is not present on the vCenter.</p>
<h2>The metrics</h2>
<p></p><pre class="urvanov-syntax-highlighter-plain-tag">function Get-PerfCounterList{
	param($pm)

	$list = @{}
	$pm.PerfCounter | % {
		$obj = &quot;&quot; | Select Name, Level, Summary
		$obj.Name = $_.GroupInfo.key + &quot;.&quot; + $_.NameInfo.key + &quot;.&quot; + $pm.Description.CounterType[$_.RollupType].Key

		$obj.Level = $_.Level
		$obj.Summary = $_.NameInfo.Summary
		$list[$_.Key] = $obj
	}
	$list
}

function Get-StatId{
param($entity, $pm, $perfCounterList)

$result = @()

$perfProvider = $pm.QueryPerfProviderSummary($entity.MoRef)

if($perfProvider.SummarySupported){
	$perfMetrics = $pm.QueryAvailablePerfMetric($entity.MoRef,$null,$null,$null)
	if($perfMetrics){
		foreach($metric in $perfMetrics){
			$row = &quot;&quot; | Select Entity, Interval, CounterId, Stat, Instance, Level, Summary
			$row.Entity = $entity.GetType().Name
			$row.Interval = &quot;Aggregate&quot;
			$row.CounterId = $metric.CounterId
			$row.Stat = $perfCounterList[$metric.CounterId].Name
			$row.Instance = $metric.Instance
			$row.Level = $perfCounterList[$metric.CounterId].Level
			$row.Summary = $perfCounterList[$metric.CounterId].Summary
			$result += $row
		}
	}
}

if($perfProvider.CurrentSupported){
	$perfMetrics = $pm.QueryAvailablePerfMetric($entity.MoRef,$null,$null,$perfProvider.refreshRate)
	foreach($metric in $perfMetrics){
		$row = &quot;&quot; | Select Entity, Interval, CounterId, Stat, Instance, Level, Summary
		$row.Entity = $entity.GetType().Name
		$row.Interval = &quot;RealTime&quot;
		$row.CounterId = $metric.CounterId
		$row.Stat = $perfCounterList[$metric.CounterId].Name
		$row.Instance = $metric.Instance
		$row.Level = $perfCounterList[$metric.CounterId].Level
		$row.Summary = $perfCounterList[$metric.CounterId].Summary
		$result += $row
	}
}
$result
}

$pm = Get-View (Get-View ServiceINstance).Content.PerfManager
$perfCounterList = Get-PerfCounterList $pm

$report = @()

# Datacenter
$dc = Get-Datacenter | Select-Object -First 1 | Get-View
$report += (Get-StatId $dc $pm $perfCounterList)

# Datastore
$ds = Get-Datastore | Select-Object -First 1 | Get-View
if($ds){
	$report += (Get-StatId $ds $pm $perfCounterList)
}

# VirtualMachine
$vm = Get-VM | where{$_.PowerState -eq 'PoweredOn'} | Select-Object -First 1 | Get-View
if($vm){
	$report += (Get-StatId $vm $pm $perfCounterList)
}

# HostSystem
$vmhost = Get-VmHost | where{$_.State -eq 'Connected'} | Select-Object -First 1 | Get-View
if($vmhost){
	$report += (Get-StatId $vmhost $pm $perfCounterList)
}

# ClusterComputeResource
$cluster = Get-Cluster | Select-Object -First 1 | Get-View
if($cluster){
	$report += (Get-StatId $cluster $pm $perfCounterList)
}

# ResourcePool
$respool = Get-ResourcePool | Select-Object -First 1 | Get-View
$report += (Get-StatId $respool $pm $perfCounterList)

$report | Export-Csv &quot;C:\Stat-Ids.csv&quot; -NoTypeInformation -UseCulture</pre><p></p>
<h4>Annotations</h4>
<p><strong>Line 1-13</strong>: in this function I create a hash table where the key is performance counter Id and the value is an object that contains specific information about the metric: the composite name (group-name-rollup), the statistics level where it is available and the summary description of the metric</p>
<p><strong>Line 21</strong>: In the PerfProvider for an entity we can find out if the entity has &#8220;realtime&#8221; and/or &#8220;aggregate&#8221; metrics</p>
<p><strong>Line 23-38</strong>: this part of the function retrieves the available &#8220;aggregate&#8221; metrics if they exist</p>
<p><strong>Line 24</strong>: the <a href="https://www.vmware.com/support/developer/vc-sdk/visdk400pubs/ReferenceGuide/vim.PerformanceManager.html#queryAvailableMetric" target="_blank">QueryAvailablePerfMetric</a> method is where the script finds out which metrics are available for a specific entity.</p>
<p><strong>Line 40-53</strong>: this part of the function retrieves the available &#8220;realtime&#8221;metrics if they exist</p>
<p><strong>Line 62-92</strong>: the metrics are collected for all entities that have performance metrics. You can leave out specific entities if you don&#8217;t want those metrics in the list.</p>
<p><strong>Line 73,79</strong>: a powered-off guest or a disconnected host will not return all the possible metrics. By adding a where-clause this problem is avoided.</p>
<p>This resulting list makes it easy to define <a href="https://www.vmware.com/support/developer/vc-sdk/visdk400pubs/ReferenceGuide/vim.alarm.MetricAlarmExpression.html" target="_blank">MetricAlarmExpression</a> objects. In fact you can now create alarms that you can <strong>not create via the vSphere client</strong> !<strong><br />
</strong></p>
<p>As an example, suppose you want to be alerted when one of your <strong>ESX</strong> servers is <strong>receiving</strong> <strong>network</strong> traffic over a specific watermark.</p>
<p>In the vSphere client you can create an alarm for <strong>Network Usage</strong>, but that will be the <strong>total</strong> of <strong>incoming</strong> and <strong>outgoing</strong> network traffic. And here I want to create an alarm for incoming network traffic only.</p>
<p>From the CSV file it&#8217;s simple to find that the script will need to use performance counter Id <strong>102</strong>.</p>
<p><a href="https://www.lucd.info/2009/11/24/alarm-expressions-part-1-metric-alarms/perf-id-102-2/" rel="attachment wp-att-1028"><img loading="lazy" decoding="async" class="aligncenter size-full wp-image-1028" title="Perf-Id-102" src="https://lucd.info/wp-content/uploads/2009/11/Perf-Id-1021.png" alt="Perf-Id-102" width="854" height="79" srcset="https://www.lucd.info/wp-content/uploads/2009/11/Perf-Id-1021.png 854w, https://www.lucd.info/wp-content/uploads/2009/11/Perf-Id-1021-300x27.png 300w" sizes="auto, (max-width: 854px) 100vw, 854px" /></a></p>
<p><span style="color: #ff0000;"><strong>Note</strong></span> that the instances you see in this CSV file are not  necessarily all the possible instances you can encounter in your vSphere environment.</p>
<p>For example there could be a virtual machine with 10 hard disks connected. If that guest was not used to compile the available metrics for the VirtualMachine object, you would not see for example all the available instances in the <strong>virtualdisk</strong> group !</p>
<p>In the screenshot you can see that the script used a guest with 2 virtual hard disks to compile the CSV.</p>
<p><a href="https://lucd.info/wp-content/uploads/2009/11/Perf-Id-Instances.png"><img loading="lazy" decoding="async" class="alignnone size-full wp-image-2590" title="Perf-Id-Instances" src="https://lucd.info/wp-content/uploads/2009/11/Perf-Id-Instances.png" alt="" width="771" height="153" srcset="https://www.lucd.info/wp-content/uploads/2009/11/Perf-Id-Instances.png 771w, https://www.lucd.info/wp-content/uploads/2009/11/Perf-Id-Instances-300x59.png 300w" sizes="auto, (max-width: 771px) 100vw, 771px" /></a></p>
<h2>The alarm</h2>
<p>The following script will create the alarm.</p>
<p></p><pre class="urvanov-syntax-highlighter-plain-tag">$esxName = &quot;esx1.lucd.info&quot;
$mailTo = &quot;luc.dekens@lucd.info&quot;

$alarmMgr = Get-View AlarmManager
$entity = Get-VmHost $esxName | Get-View

# AlarmSpec
$alarm = New-Object VMware.Vim.AlarmSpec
$alarm.Name = &quot;Net received rate&quot;
$alarm.Description = &quot;Testing network related alarms&quot;
$alarm.Enabled = $TRUE

# Action - Send email
$alarm.action = New-Object VMware.Vim.GroupAlarmAction

$trigger = New-Object VMware.Vim.AlarmTriggeringAction
$trigger.action = New-Object VMware.Vim.SendEmailAction
$trigger.action.ToList = $mailTo
$trigger.action.Subject = &quot;Net received alarm&quot;
$trigger.Action.CcList = &quot;&quot;
$trigger.Action.Body = &quot;&quot;

# Transition a - yellow --&gt; red
$transa = New-Object VMware.Vim.AlarmTriggeringActionTransitionSpec
$transa.StartState = &quot;yellow&quot;
$transa.FinalState = &quot;red&quot;

# Transition b - red --&gt; yellow
$transb = New-Object VMware.Vim.AlarmTriggeringActionTransitionSpec
$transb.StartState = &quot;red&quot;
$transb.FinalState = &quot;yellow&quot;

$trigger.TransitionSpecs += $transa
$trigger.TransitionSpecs += $transb

$alarm.action.action += $trigger

# Expression - Network data receive rate
$expression = New-Object VMware.Vim.MetricAlarmExpression
$expression.Metric = New-Object VMware.Vim.PerfMetricId
$expression.Metric.CounterId = 102
$expression.Metric.Instance = &quot;&quot;
$expression.Operator = &quot;isAbove&quot;
$expression.Red = 300
$expression.Yellow = 150
$expression.Type = &quot;HostSystem&quot;

$alarm.expression = New-Object VMware.Vim.OrAlarmExpression
$alarm.expression.expression += $expression

$alarm.setting = New-Object VMware.Vim.AlarmSetting
$alarm.setting.reportingFrequency = 0
$alarm.setting.toleranceRange = 0

# Create alarm.
$alarmMgr.CreateAlarm($entity.MoRef, $alarm)</pre><p></p>
<h4>Annotations</h4>
<p><strong>Line 44-45</strong>: the watermarks are defined in KBps. The values in the script are values for demonstration purposes only. Correct these for your own environment.</p>
<p>In the vSPhere client you will see the following warning when you <strong>edit</strong> the <strong>settings</strong> of the alarm and select the <strong>Triggers</strong> tab.</p>
<p style="text-align: center;"><a href="https://www.lucd.info/2009/11/24/alarm-expressions-part-1-metric-alarms/trigger-not-visible/" rel="attachment wp-att-1029"><img loading="lazy" decoding="async" class="aligncenter size-full wp-image-1029" title="trigger-not-visible" src="https://lucd.info/wp-content/uploads/2009/11/trigger-not-visible.png" alt="trigger-not-visible" width="470" height="299" srcset="https://www.lucd.info/wp-content/uploads/2009/11/trigger-not-visible.png 734w, https://www.lucd.info/wp-content/uploads/2009/11/trigger-not-visible-300x190.png 300w" sizes="auto, (max-width: 470px) 100vw, 470px" /></a></p>
<p>But rest assured, this alarm <strong>works</strong> and will fire when the metric goes over the yellow and red watermarks.</p>
]]></content:encoded>
					
					<wfw:commentRss>https://www.lucd.info/2009/11/24/alarm-expressions-part-1-metric-alarms/feed/</wfw:commentRss>
			<slash:comments>9</slash:comments>
		
		
			</item>
	</channel>
</rss>
