Re: Unified Manager 6.3 Alert scripts

I have got the script to execute, but am having trouble passing the email address configured for the alert to the script. Currently I get the default OCUM script sent to me as well as the custom script which has my email address hardcoded into the script.


Any ideas?

Re: Unified Manager 6.3 Alert scripts

[ Edited ]

I have this mostly working for version 7.1 but have run into a snag. When I run the script outside of Unified Manager it picks up all the event information just fine and will pass it to msend and create a ticket in our remedy system. 


However when the script runs automatically based on a triggered event it doesn't look like the script is ever actually running as no ticket gets created. Any thoughts?


Is the event ID no longer $args[1]?



Re: Unified Manager 6.3 Alert scripts

Hi Taber,


The $args[1] variable is definately the EventID however there does appear to be a discrepancy in the documentation.

I'm not sure if it's an error in the documentation or the variable order has changed between OCUM 6.X and 7.X (Page 81-82).

In the documented example:


$args[3] = EventSourceID


(That is incorrect, in OCUM 7.1 the "EventSourceID" is $args[8]). If


If you are ever in any doubt as to what the argument parameter names and values are...

I recommend logging them in your OCUM alarm script using the following powershell code:


$fileSpec = "C:\Program Files\NetApp\ocum\scriptPlugin\output.log"
$("OCUM Event Argument 0`: " + $args[0])   | Out-File -FilePath $fileSpec -encoding ASCII -Append
$("OCUM Event Argument 1`: " + $args[1])   | Out-File -FilePath $fileSpec -encoding ASCII -Append
$("OCUM Event Argument 2`: " + $args[2])   | Out-File -FilePath $fileSpec -encoding ASCII -Append
$("OCUM Event Argument 3`: " + $args[3])   | Out-File -FilePath $fileSpec -encoding ASCII -Append
$("OCUM Event Argument 4`: " + $args[4])   | Out-File -FilePath $fileSpec -encoding ASCII -Append
$("OCUM Event Argument 5`: " + $args[5])   | Out-File -FilePath $fileSpec -encoding ASCII -Append
$("OCUM Event Argument 6`: " + $args[6])   | Out-File -FilePath $fileSpec -encoding ASCII -Append
$("OCUM Event Argument 7`: " + $args[7])   | Out-File -FilePath $fileSpec -encoding ASCII -Append
$("OCUM Event Argument 8`: " + $args[8])   | Out-File -FilePath $fileSpec -encoding ASCII -Append
$("OCUM Event Argument 9`: " + $args[9])   | Out-File -FilePath $fileSpec -encoding ASCII -Append
$("OCUM Event Argument 10`: " + $args[10]) | Out-File -FilePath $fileSpec -encoding ASCII -Append
$("OCUM Event Argument 11`: " + $args[11]) | Out-File -FilePath $fileSpec -encoding ASCII -Append

Example output:

OCUM Event Argument 0: -eventID
OCUM Event Argument 1: 54
OCUM Event Argument 2: -eventName
OCUM Event Argument 3: LUN
OCUM Event Argument 4: Offline
OCUM Event Argument 5: -eventSeverity
OCUM Event Argument 6: critical
OCUM Event Argument 7: -eventSourceID
OCUM Event Argument 8: 224
OCUM Event Argument 9: -eventSourceName
OCUM Event Argument 10: vserver4:/volume_002/lun_001
OCUM Event Argument 11: -eventSourceType
OCUM Event Argument 12: LUN




If this post resolved your issue, help others by selecting ACCEPT AS SOLUTION or adding a KUDO.

Re: Unified Manager 6.3 Alert scripts

Hi Uber,


You could try invoking a SQL query in your script to enumerate the email address matching the Script name. EG:


   alert_emailaddressrecipients.emailAddress AS 'email_address'
   alert_emailaddressrecipients.alert_id =
   alert.scriptId =
AND = '$scriptName'

You can dynamically determine what the script name that is running is within your OCUM script plugin directory using powershell scirpt. EG:


#'Initialization Section. Define Global Variables.
[String]$scriptPath     = Split-Path($MyInvocation.MyCommand.Path)
[String]$scriptSpec     = $MyInvocation.MyCommand.Definition
[String]$scriptBaseName = (Get-Item $scriptSpec).BaseName
[String]$scriptName     = (Get-Item $scriptSpec).Name
#'Display variables.
Write-Host "Script Path`: $scriptPath"
Write-Host "Script Spec`: $scriptSpec"
Write-Host "Script Base Name`: $scriptBaseName"
Write-Host "Script Name`: $scriptName"


Example output:


PS C:\Program Files\NetApp\ocum\scriptPlugin> .\test.ps1
Script Path: C:\Program Files\NetApp\ocum\scriptPlugin
Script Spec: C:\Program Files\NetApp\ocum\scriptPlugin\test.ps1
Script Base Name: test
Script Name: test.ps1

This way you wouldn't have to hard code email addresses in your script if you have already configured email address in OCUM.



If this post resolved your issue, help others by selecting ACCEPT AS SOLUTION or adding a KUDO.