- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Hi Uber,
You could try invoking a SQL query in your script to enumerate the email address matching the Script name. EG:
SELECT alert_emailaddressrecipients.emailAddress AS 'email_address' FROM ocum.alert, ocum.alert_emailaddressrecipients, ocum.script WHERE alert_emailaddressrecipients.alert_id = alert.id AND alert.scriptId = script.id AND script.name = '$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.
/Matt
If this post resolved your issue, help others by selecting ACCEPT AS SOLUTION or adding a KUDO.