<?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: Modify Email Alerts OCUM 7 in Active IQ Unified Manager Discussions</title>
    <link>https://community.netapp.com/t5/Active-IQ-Unified-Manager-Discussions/Modify-Email-Alerts-OCUM-7/m-p/139436#M25429</link>
    <description>&lt;P&gt;Hi Vikramjeet,&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Here is an "example" for you that you can modify to meet your requirements. You would need to:&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;UL&gt;
&lt;LI&gt;Update the variables "$to", "$from" and "$smtpServer" to the relevent values in your infrastructure&lt;/LI&gt;
&lt;LI&gt;Add any additional lines you require to the $body variable&lt;/LI&gt;
&lt;LI&gt;Format the CSS and HTML to meet your requirements&lt;/LI&gt;
&lt;/UL&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Please let me know if you have any questions.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;#'------------------------------------------------------------------------------
#'Initialization Section. Define Global Variables.
#'------------------------------------------------------------------------------
[String]$hostname       = $env:computername
[HashTable]$event       = @{}
[HashTable]$eventArgs   = @{}
[String]$to             = ""
[String]$from           = "" 
[String]$smtpserver     = ""
#'------------------------------------------------------------------------------
#'Add the OCUM event arguments to hashtable.
#'------------------------------------------------------------------------------
For($i = 0; $i -le $Args.Count -1; $i++){
   If($Args[$i] -is [String]){
      If($Args[$i].StartsWith("-")){
         [String]$key = $Args[$i] -Replace("-", "")
         If(-Not($event.ContainsKey($key))){
            [HashTable]$event.Add($key, $Args[$i + 1])
         }
      }
   }
}
#'------------------------------------------------------------------------------
#'Add the OCUM event "eventArgs" to a hashtable if it contains sub arguments.
#'------------------------------------------------------------------------------
[String]$arguments     = $event["eventArgs"]
[Bool]$isEventArgsNull = $True
If(($arguments -ne $Null) -And ($arguments.Contains("="))){
   [Bool]$isEventArgsNull = $False
   [Array]$elements = $arguments.Split(" ")
   ForEach($element In $elements){
      $key   = $element.Split("=")[0]
      $value = $element.Split("=")[1]
      If(-Not($eventArgs.ContainsKey($key))){
         [HashTable]$eventArgs.Add($key, $value)
      }
   }
}
#'------------------------------------------------------------------------------
#'Exit processing if the OCUM event state is not new (Exit if resolved or obselete).
#'------------------------------------------------------------------------------
[Int]$eventId       = $event["eventID"]
[String]$eventState = $event["eventState"]
If(-Not($eventState -eq "new")){
   Exit 0
}
#'------------------------------------------------------------------------------
#'Set the HTML body and CSS for style formatting.
#'------------------------------------------------------------------------------
$body  = "&amp;lt;html&amp;gt;&amp;lt;head&amp;gt;&amp;lt;title&amp;gt;&amp;lt;/title&amp;gt;&amp;lt;style type=""text/css""&amp;gt;.Title {background: #0077D4;color: #FFFFFF;text-align:center;font-weight:bold;}&amp;lt;/style&amp;gt;&amp;lt;/head&amp;gt;&amp;lt;body&amp;gt;"
$body += "&amp;lt;h2&amp;gt;OCUM Event&amp;lt;/h2&amp;gt;"
$body += "&amp;lt;table&amp;gt;&amp;lt;tr class='Title'&amp;gt;&amp;lt;td&amp;gt;Event Property Name&amp;lt;/td&amp;gt;&amp;lt;td&amp;gt;Event Property Value&amp;lt;/td&amp;gt;&amp;lt;/tr&amp;gt;"
ForEach($key In $event.Keys){
   Do{
      If($key -eq "eventArgs"){
         Break;
      }
      $body += $("&amp;lt;tr&amp;gt;&amp;lt;td&amp;gt;" + $key + "&amp;lt;/td&amp;gt;&amp;lt;td&amp;gt;" + $event[$key] + "&amp;lt;/td&amp;gt;&amp;lt;/tr&amp;gt;")
   }Until($True)
 
}
If(-Not($isEventArgsNull)){
   ForEach($key In $eventArgs.Keys){
      $body += $("&amp;lt;tr&amp;gt;&amp;lt;td&amp;gt;" + $key + "&amp;lt;/td&amp;gt;&amp;lt;td&amp;gt;" + $eventArgs[$key] + "&amp;lt;/td&amp;gt;&amp;lt;/tr&amp;gt;") 
   }
}
$body += "&amp;lt;/table&amp;gt;&amp;lt;/body&amp;gt;&amp;lt;/html&amp;gt;"
$body += "&amp;lt;p&amp;gt;Script run from ""$hostName"""
#'------------------------------------------------------------------------------
#'Send the OCUM event as a HTML email (only for volume full or volume nearly full events).
#'------------------------------------------------------------------------------
If(-Not($isEventArgsNull)){&lt;BR /&gt;&amp;nbsp;&amp;nbsp; If(($eventArgs.ContainsKey("volNearlyFull")) -Or ($eventArgs.ContainsKey("volFull"))){&lt;BR /&gt;&amp;nbsp;&amp;nbsp;    Try{&lt;BR /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;    Send-MailMessage -to $to -from $from -Subject "OCUM Event`: $eventId" -SmtpServer $smtpserver -Body $body -BodyAsHtml -ErrorAction Stop&lt;BR /&gt;&amp;nbsp;&amp;nbsp;    }Catch{&lt;BR /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;    Exit -1&lt;BR /&gt;&amp;nbsp;&amp;nbsp;    }&lt;BR /&gt;   }&lt;BR /&gt;}
#'------------------------------------------------------------------------------&lt;/PRE&gt;
&lt;P&gt;Hope that helps&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;/Matt&lt;/P&gt;</description>
    <pubDate>Sat, 07 Apr 2018 08:32:32 GMT</pubDate>
    <dc:creator>mbeattie</dc:creator>
    <dc:date>2018-04-07T08:32:32Z</dc:date>
    <item>
      <title>Modify Email Alerts OCUM 7</title>
      <link>https://community.netapp.com/t5/Active-IQ-Unified-Manager-Discussions/Modify-Email-Alerts-OCUM-7/m-p/139181#M25364</link>
      <description>&lt;P&gt;We are looking to modify email alert send through OCUM when volume is full&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;We need to edit email body to our needs i.e. add couple of line to the email body&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;I have looked into some forums but I am bit confused.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Can you please help...where shall I start from?&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;I know that we can write a powershell script and add that to each and every alert on OCUM&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;I dont know how to modify email alert through powershell scripts&lt;SPAN&gt;&amp;nbsp;&lt;/SPAN&gt;&lt;IMG class="emoticon emoticon-smileysad" src="https://community.netapp.com/i/smilies/16x16_smiley-sad.png" border="0" alt="Smiley Sad" title="Smiley Sad" /&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Can you please advice!!!&lt;/P&gt;</description>
      <pubDate>Wed, 04 Jun 2025 13:52:33 GMT</pubDate>
      <guid>https://community.netapp.com/t5/Active-IQ-Unified-Manager-Discussions/Modify-Email-Alerts-OCUM-7/m-p/139181#M25364</guid>
      <dc:creator>Vikramjeet_Singh</dc:creator>
      <dc:date>2025-06-04T13:52:33Z</dc:date>
    </item>
    <item>
      <title>Re: Modify Email Alerts OCUM 7</title>
      <link>https://community.netapp.com/t5/Active-IQ-Unified-Manager-Discussions/Modify-Email-Alerts-OCUM-7/m-p/139436#M25429</link>
      <description>&lt;P&gt;Hi Vikramjeet,&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Here is an "example" for you that you can modify to meet your requirements. You would need to:&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;UL&gt;
&lt;LI&gt;Update the variables "$to", "$from" and "$smtpServer" to the relevent values in your infrastructure&lt;/LI&gt;
&lt;LI&gt;Add any additional lines you require to the $body variable&lt;/LI&gt;
&lt;LI&gt;Format the CSS and HTML to meet your requirements&lt;/LI&gt;
&lt;/UL&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Please let me know if you have any questions.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;#'------------------------------------------------------------------------------
#'Initialization Section. Define Global Variables.
#'------------------------------------------------------------------------------
[String]$hostname       = $env:computername
[HashTable]$event       = @{}
[HashTable]$eventArgs   = @{}
[String]$to             = ""
[String]$from           = "" 
[String]$smtpserver     = ""
#'------------------------------------------------------------------------------
#'Add the OCUM event arguments to hashtable.
#'------------------------------------------------------------------------------
For($i = 0; $i -le $Args.Count -1; $i++){
   If($Args[$i] -is [String]){
      If($Args[$i].StartsWith("-")){
         [String]$key = $Args[$i] -Replace("-", "")
         If(-Not($event.ContainsKey($key))){
            [HashTable]$event.Add($key, $Args[$i + 1])
         }
      }
   }
}
#'------------------------------------------------------------------------------
#'Add the OCUM event "eventArgs" to a hashtable if it contains sub arguments.
#'------------------------------------------------------------------------------
[String]$arguments     = $event["eventArgs"]
[Bool]$isEventArgsNull = $True
If(($arguments -ne $Null) -And ($arguments.Contains("="))){
   [Bool]$isEventArgsNull = $False
   [Array]$elements = $arguments.Split(" ")
   ForEach($element In $elements){
      $key   = $element.Split("=")[0]
      $value = $element.Split("=")[1]
      If(-Not($eventArgs.ContainsKey($key))){
         [HashTable]$eventArgs.Add($key, $value)
      }
   }
}
#'------------------------------------------------------------------------------
#'Exit processing if the OCUM event state is not new (Exit if resolved or obselete).
#'------------------------------------------------------------------------------
[Int]$eventId       = $event["eventID"]
[String]$eventState = $event["eventState"]
If(-Not($eventState -eq "new")){
   Exit 0
}
#'------------------------------------------------------------------------------
#'Set the HTML body and CSS for style formatting.
#'------------------------------------------------------------------------------
$body  = "&amp;lt;html&amp;gt;&amp;lt;head&amp;gt;&amp;lt;title&amp;gt;&amp;lt;/title&amp;gt;&amp;lt;style type=""text/css""&amp;gt;.Title {background: #0077D4;color: #FFFFFF;text-align:center;font-weight:bold;}&amp;lt;/style&amp;gt;&amp;lt;/head&amp;gt;&amp;lt;body&amp;gt;"
$body += "&amp;lt;h2&amp;gt;OCUM Event&amp;lt;/h2&amp;gt;"
$body += "&amp;lt;table&amp;gt;&amp;lt;tr class='Title'&amp;gt;&amp;lt;td&amp;gt;Event Property Name&amp;lt;/td&amp;gt;&amp;lt;td&amp;gt;Event Property Value&amp;lt;/td&amp;gt;&amp;lt;/tr&amp;gt;"
ForEach($key In $event.Keys){
   Do{
      If($key -eq "eventArgs"){
         Break;
      }
      $body += $("&amp;lt;tr&amp;gt;&amp;lt;td&amp;gt;" + $key + "&amp;lt;/td&amp;gt;&amp;lt;td&amp;gt;" + $event[$key] + "&amp;lt;/td&amp;gt;&amp;lt;/tr&amp;gt;")
   }Until($True)
 
}
If(-Not($isEventArgsNull)){
   ForEach($key In $eventArgs.Keys){
      $body += $("&amp;lt;tr&amp;gt;&amp;lt;td&amp;gt;" + $key + "&amp;lt;/td&amp;gt;&amp;lt;td&amp;gt;" + $eventArgs[$key] + "&amp;lt;/td&amp;gt;&amp;lt;/tr&amp;gt;") 
   }
}
$body += "&amp;lt;/table&amp;gt;&amp;lt;/body&amp;gt;&amp;lt;/html&amp;gt;"
$body += "&amp;lt;p&amp;gt;Script run from ""$hostName"""
#'------------------------------------------------------------------------------
#'Send the OCUM event as a HTML email (only for volume full or volume nearly full events).
#'------------------------------------------------------------------------------
If(-Not($isEventArgsNull)){&lt;BR /&gt;&amp;nbsp;&amp;nbsp; If(($eventArgs.ContainsKey("volNearlyFull")) -Or ($eventArgs.ContainsKey("volFull"))){&lt;BR /&gt;&amp;nbsp;&amp;nbsp;    Try{&lt;BR /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;    Send-MailMessage -to $to -from $from -Subject "OCUM Event`: $eventId" -SmtpServer $smtpserver -Body $body -BodyAsHtml -ErrorAction Stop&lt;BR /&gt;&amp;nbsp;&amp;nbsp;    }Catch{&lt;BR /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;    Exit -1&lt;BR /&gt;&amp;nbsp;&amp;nbsp;    }&lt;BR /&gt;   }&lt;BR /&gt;}
#'------------------------------------------------------------------------------&lt;/PRE&gt;
&lt;P&gt;Hope that helps&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;/Matt&lt;/P&gt;</description>
      <pubDate>Sat, 07 Apr 2018 08:32:32 GMT</pubDate>
      <guid>https://community.netapp.com/t5/Active-IQ-Unified-Manager-Discussions/Modify-Email-Alerts-OCUM-7/m-p/139436#M25429</guid>
      <dc:creator>mbeattie</dc:creator>
      <dc:date>2018-04-07T08:32:32Z</dc:date>
    </item>
  </channel>
</rss>

