Top
ServerView Resource Coordinator VE Operation Guide

Appendix C Event Handling Function

This appendix explains the event handling function.

This function allows execution of a pre-defined file whenever the admin server receives SNMP Traps (events) from a registered device. This function works with the following devices.

The following file is executed each time an event occurs.

[Windows]
Installation_folder\Manager\etc\trapop.bat Argument 1 Argument 2 Argument 3 Argument 4 Argument 5 Argument 6

[Linux]
/etc/opt/FJSVrcvmr/trapop.sh Argument 1 Argument 2 Argument 3 Argument 4 Argument 5 Argument 6

The default-installed file 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.

For the following events, however, only the event log is displayed. The file is not executed.

Note

In a clustered manager configuration, it is necessary to store the same file on both the primary and secondary nodes for this function to work properly.


E-Mail Notification Sample

Below is a sample program that will send e-mail notifications for each event received.
To customize e-mail contents and adapt the program to your practical configuration, it is recommended to create your own version using this sample as a reference.

[Windows]
Set the following addresses (in the "E-Mail Notification Sample") to match actual environment values.

E-Mail Notification Sample(Installation_folder\Manager\etc\trapop.bat)

@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) makes use of Windows CDO (Microsoft Collaboration Data Objects) to connect to an external SMTP server and send e-mail notifications.
For details on VBScript and CDO, refer to the technical reference provided by Microsoft.

[Linux]
Set the following addresses (in the "E-Mail Notification Sample") to match actual environment values.

E-Mail Notification Sample (/etc/opt/FJSVrcvmr/trapop.sh)

#!/bin/sh
# MAIL_FROM=from_your@e-mail.address  <- sender address
# MAIL_TO=to_your@e-mail.address      <- destination address
# HOSTNAME=`/bin/uname -n`
# MAILCMD="/usr/sbin/sendmail -t"
# $MAILCMD <<ENDMAIL
# From: $MAIL_FROM
# To: $MAIL_TO
# Subject: Resource Coordinator VE($HOSTNAME) event mail
# -----------------------------------------------
# Resource Coordinator VE: event mail
# -----------------------------------------------
# $1
# ENDMAIL

When actually using this script, remove all comments and enter appropriate addresses.

#!/bin/sh
MAIL_FROM=from_your@e-mail.address  <- sender address
MAIL_TO=to_your@e-mail.address      <- destination address
HOSTNAME=`/bin/uname -n`
MAILCMD="/usr/sbin/sendmail -t"
$MAILCMD <<ENDMAIL
From: $MAIL_FROM
To: $MAIL_TO
Subject: Resource Coordinator VE($HOSTNAME) event mail
-----------------------------------------------
Resource Coordinator VE: event mail
-----------------------------------------------
$1
ENDMAIL

Information

The above sample assumes that the sendmail command is available on the admin server. Adapt the path to the sendmail command to your own environment. The outgoing SMTP server can be defined by changing the sendmail command's configuration files.