Loading...

Setting Up Command Line Alert Notifications

The 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 computer or on remote computers but is executed only on the CommServe computer.

Before You Begin

Create the command processor executable file. This file generates the command line alert notification and can be created on the CommServe computer or on remote clients, for example, C:\WINDOWS\system32\cmd.exe. The command can be configured with arguments. The system allows multiple arguments if they are separated by spaces.

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

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

In the preceding example, note the tilde (~) between the percent (%) and the parameter position number. 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.

Procedure

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

  1. Create an alert.
  2. On the Notification Type(s) Selection page, click the Run Command tab to send the alert by executing a command script.
  3. Select the Select [Run Command] for notification check box.
  4. If the command resides in a network share, click Use Network Share and click the Change button to provide the account information needed to access the network share.
  5. In the Command Executable Location box, specify the location of the command processor executable file.

    This is the file you created on the CommServe computer or on remote clients, for example, C:\WINDOWS\system32\cmd.exe.

  6. In the Arguments box, specify the command arguments:
    • Enter the following prior to adding any arguments:

      /C C:\Tmp\runCommandTest.bat

      where:

      • /C signifies that the Command Processor must carry out the given command in the following string and then terminate.
      • C:\Tmp\runCommandTest.bat is the location of the batch file you wish to run when the alert criteria threshold is met.
    • Enter the argument values and add quotation marks around each value to resolve potential white space issues.

      For example: "<DETECTED CRITERIA>"

      See Available Alert Tokens for a list of tokens or arguments.

    Example of the format and values needed in the Argument box:

    /C C:\Tmp\runCommandTest.bat "<ALERT NAME>" "<DETECTED CRITERIA>"

  7. Click Next.
  8. On the Summary page, review your selections and click Finish.

Result

This example displays the logs after the command line alert notification is generated. These logs are available at software_installation_directory\Log Files\EvMgrS.

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

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

Last modified: 11/13/2019 7:16:35 AM