<?xml version="1.0" encoding="UTF-8"?>
<rss xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" xmlns:taxo="http://purl.org/rss/1.0/modules/taxonomy/" version="2.0">
  <channel>
    <title>topic Re: Passing host name to triggered alarm in VMware PowerCLI Discussions</title>
    <link>https://communities.vmware.com/t5/VMware-PowerCLI-Discussions/Passing-host-name-to-triggered-alarm/m-p/930862#M27573</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;When an Alarm is fired, there are a number of environment variables available, see &lt;SPAN style="color: #000000; font-family: Arial, Helvetica, sans-serif; font-size: 16px; font-weight: bold;"&gt;&lt;A href="https://pubs.vmware.com/vsphere-60/topic/com.vmware.vsphere.hostclient.doc/GUID-5F5932FA-71FA-473E-8776-92B00742D566.html"&gt;Alarm Environment Variables for Scripts&lt;/A&gt;.&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;The hostname is in &lt;SPAN style="color: #333333; font-family: Arial, Helvetica, sans-serif; font-size: 12px;"&gt;VMWARE_ALARM_EVENT_HOST.&lt;/SPAN&gt;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Fri, 23 Jun 2017 06:01:44 GMT</pubDate>
    <dc:creator>LucD</dc:creator>
    <dc:date>2017-06-23T06:01:44Z</dc:date>
    <item>
      <title>Passing host name to triggered alarm</title>
      <link>https://communities.vmware.com/t5/VMware-PowerCLI-Discussions/Passing-host-name-to-triggered-alarm/m-p/930861#M27572</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Have configured alarm action to run a command, Is there a way for me to pass the Esxi host name for which the alarm has been triggered ?&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;TIA&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 23 Jun 2017 03:55:32 GMT</pubDate>
      <guid>https://communities.vmware.com/t5/VMware-PowerCLI-Discussions/Passing-host-name-to-triggered-alarm/m-p/930861#M27572</guid>
      <dc:creator>Dinu26</dc:creator>
      <dc:date>2017-06-23T03:55:32Z</dc:date>
    </item>
    <item>
      <title>Re: Passing host name to triggered alarm</title>
      <link>https://communities.vmware.com/t5/VMware-PowerCLI-Discussions/Passing-host-name-to-triggered-alarm/m-p/930862#M27573</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;When an Alarm is fired, there are a number of environment variables available, see &lt;SPAN style="color: #000000; font-family: Arial, Helvetica, sans-serif; font-size: 16px; font-weight: bold;"&gt;&lt;A href="https://pubs.vmware.com/vsphere-60/topic/com.vmware.vsphere.hostclient.doc/GUID-5F5932FA-71FA-473E-8776-92B00742D566.html"&gt;Alarm Environment Variables for Scripts&lt;/A&gt;.&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;The hostname is in &lt;SPAN style="color: #333333; font-family: Arial, Helvetica, sans-serif; font-size: 12px;"&gt;VMWARE_ALARM_EVENT_HOST.&lt;/SPAN&gt;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 23 Jun 2017 06:01:44 GMT</pubDate>
      <guid>https://communities.vmware.com/t5/VMware-PowerCLI-Discussions/Passing-host-name-to-triggered-alarm/m-p/930862#M27573</guid>
      <dc:creator>LucD</dc:creator>
      <dc:date>2017-06-23T06:01:44Z</dc:date>
    </item>
    <item>
      <title>Re: Passing host name to triggered alarm</title>
      <link>https://communities.vmware.com/t5/VMware-PowerCLI-Discussions/Passing-host-name-to-triggered-alarm/m-p/930863#M27574</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi LucD,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Thanks Much for the response. &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Am being dumb here,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Have tried passing the host name through alarm as well as script, But am unable to figure it out. &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I tried with TargetName and &lt;SPAN style="color: #333333; font-family: Arial, Helvetica, sans-serif; font-size: 12px;"&gt; VMWARE_ALARM_TARGET_NAME but no luck&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper" image-alt="pastedImage_0.png"&gt;&lt;img src="https://communities.vmware.com/t5/image/serverpage/image-id/73612iE3A3D3036EEE5C8D/image-size/large?v=v2&amp;amp;px=999" role="button" title="pastedImage_0.png" alt="pastedImage_0.png" /&gt;&lt;/span&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;Below is what I have in TT.cmd.&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Set Parm1= {VMWARE_ALARM_TARGET_NAME}&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;echo "am being called" &amp;gt;&amp;gt; "C:\ProgramData\VMware\VMware VirtualCenter\scripts\test.txt"&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;echo Parm1 &amp;gt;&amp;gt; "C:\ProgramData\VMware\VMware VirtualCenter\scripts\test.txt"&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;C:\Windows\System32\cmd.exe /c powershell.exe -noninteractive -noprofile -file "C:\ProgramData\VMware\VMware VirtualCenter\scripts\tt.ps1" %Parm1%&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;Below is the code in tt.ps1&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;[CmdletBinding()]&lt;/P&gt;&lt;P&gt;Param(&lt;/P&gt;&lt;P&gt;[Parameter(Mandatory=$True,Position=1)]&lt;/P&gt;&lt;P&gt;[string]$Test&lt;/P&gt;&lt;P&gt;)&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;write-host $Test&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;$ExchangeServer = "***********"&lt;/P&gt;&lt;P&gt;$FromAddress = "**********"&lt;/P&gt;&lt;P&gt;$to = "**************"&lt;/P&gt;&lt;P&gt;$te =&amp;nbsp; "Am being called by Alarm" &lt;/P&gt;&lt;P&gt;$te | Out-File -filepath "C:\ProgramData\VMware\VMware VirtualCenter\scripts\test.txt" -Append&lt;/P&gt;&lt;P&gt;Send-MailMessage -from $FromAddress -To $to -Body "test 1 and $Test" -Subject "top" -SmtpServer $ExchangeServer&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 30 Jun 2017 15:29:51 GMT</pubDate>
      <guid>https://communities.vmware.com/t5/VMware-PowerCLI-Discussions/Passing-host-name-to-triggered-alarm/m-p/930863#M27574</guid>
      <dc:creator>Dinu26</dc:creator>
      <dc:date>2017-06-30T15:29:51Z</dc:date>
    </item>
    <item>
      <title>Re: Passing host name to triggered alarm</title>
      <link>https://communities.vmware.com/t5/VMware-PowerCLI-Discussions/Passing-host-name-to-triggered-alarm/m-p/930864#M27575</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Have a look at Horst's (oldish) document name&lt;SPAN&gt;d &lt;SPAN style="font-family: sans-serif;"&gt;&lt;A href="http://docshare.tips/fun-with-vsphere-alarms_58498ddbb6d87f9da58b48a7.html"&gt;Fun with vSphere Alarms&lt;/A&gt;​&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-family: sans-serif;"&gt;In section 5 of that document he demonstrates a method to discover all environment variables that are available when an alarm is fired.&lt;/SPAN&gt;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 30 Jun 2017 15:48:17 GMT</pubDate>
      <guid>https://communities.vmware.com/t5/VMware-PowerCLI-Discussions/Passing-host-name-to-triggered-alarm/m-p/930864#M27575</guid>
      <dc:creator>LucD</dc:creator>
      <dc:date>2017-06-30T15:48:17Z</dc:date>
    </item>
  </channel>
</rss>

