Setting Up Alerts and Notifications - Command Line

Table of Contents

Overview

Run Command notification is used to send alert notifications from the CommServe to other client computers by executing a command script. The Run Command can be located on the CommServe or remote machines, but is executed only on the CommServe machine.

The Command Processor executable file which is required to generate command line alert notification can be created on the CommServe or remote clients  e.g., C:\WINDOWS\system32\cmd.exe and the location can be specified in the Command Script Location box while configuring the alert. The command can be configured with arguments; multiple arguments should be separated by spaces, which the system allows.

Example

The following is the content of the batch file for example:

REM runCommandTest.bat
@echo %date% %time% >> c:\tmp\alert1.log
echo %~1>>c:\tmp\alert1.log
echo %~2>>c:\tmp\alert1.log
echo %3>>c:\tmp\alert1.log
echo %4>>c:\tmp\alert1.log
echo %5>>c:\tmp\alert1.log
echo %6>>c:\tmp\alert1.log
echo %7>>c:\tmp\alert1.log
echo %8>>c:\tmp\alert1.log
echo %9>>c:\tmp\alert1.log
REM End Batch File

Note the '~' character between the '%' character and the parameter position number above; this signifies the command processor to strip off the quotation characters at the beginning and end of the parameter. If this is not done, the quotation marks remain as part of the parameter, which may be useful if the batch file is calling another program or batch file.

Enter the following in the Arguments field prior to adding any arguments:

/C C:\Tmp\runCommandTest.bat

where the \C signifies that the Command Processor must carry out the given command in the following string and then terminate. Note that C:\Tmp\runCommandTest.bat is the location of the batch file you wish to run when the alert criteria threshold is met.

While adding the arguments manually add quotation marks around the tokens, e.g., "$<DETECTED CRITERIA>$"; this resolves any white space issues. The Arguments field will resemble the following format:
/C C:\Tmp\runCommandTest.bat "$<ALERT NAME>$" "$<DETECTED CRITERIA>$"

Below example displays the logs after Command Line notification alert has been generated. These logs are generated at C:\Program Files\<Company>\<Product>\Log Files\EvMgrS.

492564 7892c 05/04 17:55:21 ### processRunCommand() - About to spawn [C:\Program Files\<Company>\<Product>\Base\qlogin.exe]["C:\Program Files\<Company>\<Product>\Base\qlogin.exe" -u admin -clp ""].

492564 7892c 05/04 17:55:21 ### CvProcess::StartProcess() - Preparing to launch process: <C:\Program Files\<Company>\<Product>\Base\qlogin.exe>. Priority: <Normal>. Value: <32>.

Configuration

No prior configuration is required to generate Command Line notification alerts.

Generation

The command line script is created when generating the alert and is executed on the CommServe when the alert criteria threshold is met.

Use the following steps to generate Run Command notifications for alerts:

  1. From the CommCell Console ribbon, click Alerts.
  2. In the Alerts dialog box, click Add.
  3. Enter a name for the alert in the Display Name box.
  4. Select a Category and Alert Type and click Next.
  5. Select the clients or client groups that you want to associate with this alert and click Next.

    To exclude specific client groups from receiving alert notifications, mark the client group with an 'X' mark.

  6. Select the notification criteria to be used and click Next.
  7. On the Notification Type(s) Selection page, click the Run Command tab to send the alert by executing a command script.
  8. Click the Select [Run Command] for notification check box and do the following:
    • By default, the command is executed from your local drive. If the command resides in a network share, click Use Network Share and click the Change button to provide the account information to access the network share.
    • Specify the location of the command processor executable file in the Command Script Location box. You can also click Browse to browse the location of the command.
    • Specify the command arguments and manually add quotation marks around the argument values. You can also click Browse to locate the arguments. See Available Alert Tokens for a list of tokens or arguments.
    • Click Next.
  9. On the Summary page, review your selections and click Finish.