SNMPTD PROBE: Alarm Message is not showing correct data when using underscore “_”

Document ID : KB000094963
Last Modified Date : 07/05/2018
Show Technical Document Details
Issue:
When using underscore “_” in combining variables as part of the alarm message, the underscore is removed

Example
    $1 = ServerName
    $2 = StatusMessage

We are expecting below result

ServerName_StatusMessage

But instead the following is happening.

ServerNameStatusMessage
Environment:
UIM 8.51
SNMPTD probe 3.30
 
Cause:
Set a profile with
Enterprise ($E), $TRAP_DESCR - TEST $1_$2

The underscore is stripped out of the alarm message
It seems that when underscore is by itself it becomes stripped.

This is by design. The underscore character is considered a variable add-on which means $1_ and $1 are the same, but any character appended to the $ variable other than this that is non-alphanumeric would work as you would expect.
For instance, $1/ is not same as $1_

Underscore is a valid symbol used in lot of variable names like binary_path, proc_cmd_line, value_last etc. So it cannot be used as a separator otherwise there is no way for probe/UIM components to distinguish whether underscore is part of variable name or it is used just to separate two variables.
Resolution:
Use any other symbol to separate the two variables like Space, Hyphen (-), Colon (:), Dot (.) or Dot followed by underscore (._). All of them are going to work without any issues.
Additional Information:
The design is part of a common library which other probes also use like the processes probe. Changing the common library to suit this purpose would affect other probes.