Shell command actions are no longer working since upgrading from 9.1.4 to 10.3

Document ID : KB000008185
Last Modified Date : 14/02/2018
Show Technical Document Details
Issue:

We have migrated from APM 9.1.4 to 10.3 and our shell command action is no longer working as expected they are failing to extract the alert name from the passed in text string. We have made no change to the script being called and the alert action definition is also the same.- The included Command parameter is 'Pass Text to Shell'

Environment:
APM 10.3 Linux
Cause:

Inspection of the logs from the custom script showed that the text format passed in differs between 9.1.4 and 10.3. In 9.1.4 it appears as follows

07/07/17 09:04:45 IST Introscope Enterprise Manager (hostname:x.x.x.x) reported:  The Alert  WILY-HEARTBEAT  fell below danger target of 95:         SuperDomain|Custom Metric Host (Virtual)|Custom Metric Process (Virtual)|Custom Metric Agent (Virtual)|Enterprise Manager:Overall Capacity (%) = 4

in 10.3 it appears as

07/07/17 05:17:30 IST Introscope Enterprise Manager (hostname:x.x.x.x) reported:  The Alert WILY-HEARTBEAT fell below danger target of 95:         SuperDomain|Custom Metric Host (Virtual)|Custom Metric Process (Virtual)|Custom Metric Agent (Virtual)|Enterprise Manager:Overall Capacity (%) = 15

The difference being the number of spaces before and after the alert name i.e. 2 spaces in 9.1.4 and only 1 in 10.3

Resolution:

In this specific example The custom perl script being used to interpret the string was coded to expect the double space i.e.

# get alert name
sub getAlertName() {
$ARGV[0] =~ /The Alert\s\s(\S+)\s/;
return $1;

this needed to be change to a single space i.e.

# get alert name
sub getAlertName() {
$ARGV[0] =~ /The Alert\s(\S+)\s/;
return $1;