I'm creating an Alert for the Health Monitor Agent and using the variable $COMPUTER_NAME as used by the default Alerts like "CAF not working" but the Computer Name is not shown and the message just shows $COMPUTER_NAME. How can I show the right name?
search cancel

I'm creating an Alert for the Health Monitor Agent and using the variable $COMPUTER_NAME as used by the default Alerts like "CAF not working" but the Computer Name is not shown and the message just shows $COMPUTER_NAME. How can I show the right name?

book

Article ID: 40921

calendar_today

Updated On:

Products

CA Automation Suite for Data Centers - Configuration Automation CA Client Automation - Asset Management CA Client Automation - IT Client Manager CA Client Automation CA Client Automation - Remote Control CA Client Automation - Asset Intelligence CA Client Automation - Desktop Migration Manager CA Client Automation - Patch Manager

Issue/Introduction

Problem:

When creating an Alert for the Health Monitor Agent and using the variable $COMPUTER_NAME as used by the default Alerts like "CAF not working", the Computer Name is not shown and the message just shows $COMPUTER_NAME. How can I show the right name?

<Please see attached file for image>

01-policy configuration.png

Environment:  

CA-Client Automation version 12.8 and newer.

Cause: 

There's no default list of variables to be used in messages as it may be assumed when looking at the predefined alerts that use $COMPUTER_NAME.

 

Resolution/Workaround:


These variables are defined in the alert file as parameters.
When creating new alerts using dms scripts, any variable that must be shown in the message must be passed to the alert as a parameter when calling hmAlertOPFormatter.exe.
In the following example we've used COMPUTER_NAME as parameter after get the %COMPUTERNAME% variable from the system when creating the alert: 

dim ret as integer
Dim cmpname as String
cmpname = EnvGetString("COMPUTERNAME")
ret = Exec("hmAlertOPFormatter.exe alertconditionexist=1 raisealertnow=1 COMPUTER_NAME=" + cmpname, true)

 
After activate it the content of the new xml alert file and the message shows the right computername:

<Name>Alert-TEC1975717</Name>
<TemplateId>0</TemplateId>
<Severity>1</Severity>
<DetectionTime>1459421737</DetectionTime>
<Description ResID="0">
<Data>This is an alert for TEC1975717 on computer $COMPUTER_NAME</Data>
<ParameterList>
<Parameter Name="COMPUTER_NAME" ResID="0" Data="ITCMDM129"/>
</ParameterList>


As this message in the alert uses $COMPUTER_NAME, we can see the name of the computer ITCMDM129 replacing the variable in the final alert.

If more parameters need to be included in the alert message,  they just need to be added to the message and the script like in the following example, where the message is:

This is an alert for TEC1975717 on computer $COMPUTER_NAME. The error code is $REASON

And the dms script updated as follows to add the new parameter:

dim ret as integer
dim errorcode as String
Dim cmpname as String
cmpname = EnvGetString("COMPUTERNAME")
errorcode = "rc20"
ret = Exec("hmAlertOPFormatter.exe alertconditionexist=1 raisealertnow=1 COMPUTER_NAME=" + cmpname + ",REASON=" + errorcode, true)

The created Alert will be

<Please see attached file for image>

11-alert.png

Environment

Release: UASIT.99000-12.8-Asset Intelligence
Component:

Attachments

1558719687914000040921_sktwi1f5rjvs16vdt.png get_app
1558719685792000040921_sktwi1f5rjvs16vds.png get_app