Multiple e-mail recipients in NOC automation

  • 7015358
  • 14-Jul-2014
  • 14-Jul-2014


NetIQ Operations Center
NetIQ AppManager Operations Portal


One of many customizable features NOC supports is the capability to send an e-mail to given recipient based on an triggered event in NOC automation. Multiple events and different event filters are supported here, and NOC also offers pre-defined e-mail scripts and templates, which greatly improve time required for implementation, and allow user to quickly reach and use this specific feature.
However, for simplicity and source code clearness, currently provided templates support only one single e-mail recipient.  But what if customer is in need to send automation e-mails to multiple recipients? Is this feasible? And if it is, then how?
This TID presents one of possible solutions of this problem.


For presented solution it is important to know, how pre-defined scripting for automation with e-mail works, and how scripts get chained. There are more possible scenarios supported by NOC automation,  for our case we selected the scenario where customer wants to be informed per e-mail in case a new alarm arrives, or an existing alarm gets changes, and the e-mail should also include full alarm information.
Here is roughly the description of the whole process:

- automation gets triggered
- it calls predefined script Action_MailElementAndAlarmInformation.fs
- this script loads another script - mailelement.fs, and calls its function send()
- function send() internally uses library mailib.fs,  which contains all functionality required for sending an e-mail
- it instantiates new object Message(),  and passes provided parameters to it
- it calls function Message.send()
- function Message.send() does all the dirty work, filling up various properties, and finally it calls function sendMessage()

When checking how the object Message() in mailib.fs is implemented, we discover that the support for multiple recipients has been already implemented there, using the array for recipients, and function addRecipient(). Unfortunately,  predefined scripting is ignoring this fact, and function sendMessage() which is implemented in maillib.fs is handling parameter for recipient as if it were containing single entry only. This is exactly the point where we want to modify and extend the code, so that it can support multiple recipients.

What needs to be done? Here are step by step instructions:

1) make a copy of original file ..\NOC\database\scripts\mail\maillib.fs
2) add to the bottom of this file (maillib.fs)  the following code snippet

// A simple send w/o attachments to multiple recipients.
//  We expect that parameter recipient is simple string with comma separated e-mail addresses
function sendMessage2( smtpserver,  subject,  sender,  body,  recipients, debug )
  var msg = new Message()
  if( arguments.length > 5 && debug )
       msg.debug = true
       writeln( "sendMessage(): debug is turned on" )
  msg.setServer( smtpserver )
  msg.setSubject( subject )
  msg.setSender( sender )
  msg.setBody( body )
  var recipientList = recipients.split(',')
  for (var i=0; i<recipientList.length; i++)  msg.addRecipient( recipientList[i] )  

  return msg.send()

3) save file mailling.fs

4) using text editor open the file "..\NOC\database\scripts\mail\mailelement.fs"
5) in this file locate the following line:

    return sendMessage( this.server,
and replace it with this line:

  return sendMessage2( this.server,
6) save mailelement.fs
That's it.

Basically, we preserved the original code sendMessage(), and based on it we created a new function sendMessage2(), where the only change - compared to original code - are two lines in bold text above.
Please notice also that the modification above expects that multiple recipients will be entered in automation configuration menu as single comma separated string, i.e.:,,