This appendix explains the event handling function.
This function allows execution of pre-defined scripts (batch file) whenever the Admin Server receives SNMP Traps (events) from a registered device. This function works with the following devices.
Chassis (Management Blade)
Managed Server (ServerView)
LAN switch
The following script is executed each time an event occurs.
Installation folder\Manager\etc\trapop.bat Argument 1 Argument 2 Argument 3 Argument 4 Argument 5 Argument 6
The default-installed script will log each event, but will not trigger any action based on those events.
However, it is possible to trigger operations such as email notifications or calls to external management software (command calls or event notifications) by providing a custom-script to use in place of the default script.
The following information is passed as arguments in trapop.bat:
Argument 1
Message describing the event
Argument 2
IP address of the device in which the event occurred
Argument 3
Host name (FQDN) inferred from the IP address received in Argument 2 (when the name cannot be inferred, this is set to the device's IP address)
Argument 4
Number of milliseconds counted from 01/01/1970 00:00:00 GMT until the current time
Argument 5
Event level ("INFO", "WARNING" or "ERROR")
Argument 6
Name of the device in which the event occurred
For the following events, however, only the event log is displayed. The event handling script is not executed.
Events logged during RC console operations, command execution, or automatic server switchovers (Auto-Recovery)
Start of processing, in-progress status, end of processing
Changes in resource status during a running process
Errors that occur within Resource Coordinator VE
Errors detected from regular monitoring (when no SNMP Trap is sent, or when SNMP traps do not reach the Manager because of communication errors or an abnormally high load on the system)
Note
In a clustered Manager configuration, it is necessary to store the same script (batch file) on both the primary and secondary nodes for this function to work properly.
E-Mail Notification Sample
Below is an example of a trapopt.bat script that will send e-mail notifications for each event received. To use this example, remove comments and set the following addresses to match actual environment values. Perform any additional customization if necessary.
Mail server address
Sender address
Destination address
E-Mail Notification Sample
@echo off rem set MAIL_SERVER_ADDRESS=server.address <- mail server address rem set MAIL_FROM=from_your@e-mail.address <- sender address rem set MAIL_TO=to_your@e-mail.address <- destination address rem set MAIL_SUBJECT="Resource Coordinator VE (%COMPUTERNAME%) event mail" rem set SENDMAIL_VBS=sendmail.vbs rem set MAILCMD=cscript"%~dp0%SENDMAIL_VBS%" %MAIL_FROM% %MAIL_TO% %MAIL_SUBJECT% %MAIL_SERVER_ADDRESS% %1 %2 %3 %4 %5 %6 //nologo rem %MAILCMD% |
When actually using this script, remove all comments and enter appropriate addresses.
@echo off set MAIL_SERVER_ADDRESS=server.address <- mail server address set MAIL_FROM=from_your@e-mail.address <- sender address set MAIL_TO=to_your@e-mail.address <- destination address set MAIL_SUBJECT="Resource Coordinator VE (%COMPUTERNAME%) event mail" set SENDMAIL_VBS=sendmail.vbs set MAILCMD=cscript"%~dp0%SENDMAIL_VBS%" %MAIL_FROM% %MAIL_TO% %MAIL_SUBJECT% %MAIL_SERVER_ADDRESS% %1 %2 %3 %4 %5 %6 //nologo %MAILCMD% |
Information
The sample sendmail.vbs file (stored in the same folder as trapopt.bat) is making use of Windows CDO (Microsoft Collaboration Data Objects) to connect to an external SMTP server and send e-mail notifications.
If it becomes necessary to customize the contents of notification e-mails, use this sample script as a reference for the creation of custom scripts.
For details on VBScript and CDO, refer to the technical reference provided by Microsoft.