ALERT: Some images may not load properly within the Knowledge Base Article. If you see a broken image, please right-click and select 'Open image in a new tab'. We apologize for this inconvenience.

processAvailability.pl plugin for EP Agent is not producing expected results on Linux - always returns 0

book

Article ID: 145702

calendar_today

Updated On:

Products

CA Application Performance Management Agent (APM / Wily / Introscope) CA Application Performance Management (APM / Wily / Introscope) INTROSCOPE DX Application Performance Management

Issue/Introduction

When running the processAvailibilty.pl plugin script on RedHat linux 6 the expected results are not returned and it always reports zero for number of processes 

introscope.epagent.stateless.MATCHEDPROCS.command=perl /opt/apm105/epagent/epaplugins/solaris/processAvailability.pl -match java
introscope.epagent.stateless.MATCHEDPROCS.delayInSeconds=900
introscope.epagent.stateless.MATCHEDPROCS.metricNotReportedAction=zero

Cause

The script uses the following section to get the list of processes 
 
 
 # NOTE: to make this work on UNIX
 # change 'comm' to 'cmd'
 #
 # Make sure to invoke the correct version of ps (not the UC Berkeley one)
 my $binPsCommand = '/usr/bin/ps -e -o comm=';


On RHEL 6 there is no /usr/bin/ps command ps is in /usr/bin

Environment

Release : 10.x

Component : APM Agents

Resolution

To correct the problem edit the file <EPAGENTHOME>/epagent/epaplugins/solaris/processAvailability.pl change /usr/bin/ps to /bin/ps 

 my $binPsCommand = '/bin/ps -e -o comm=';

Additionally as suggested in the comments in the file yo may wish replace comm with cmd 

 my $binPsCommand = '/bin/ps -e -o cmd=';

as this will allow greater flexlibility due to the extended output provided.

Using /bin/ps -e -o comm= extracts only the executable name itself from the process listing not any of the command arguments e.g.

....
mysqld
master
crond
qmgr
su
java
mingetty
....

Using /bin/ps -e -o cmd= extracts the argumenst as well e.g.

....
/usr/sbin/mysqld --basedir=/usr --datadir=/var/lib/mysql --plugin-dir=/usr/lib64/mysql/plugin --user=mysql --lo
/usr/libexec/postfix/master
crond
qmgr -l -t fifo -u
su layer7 -c /opt/SecureSpan/JDK/bin/java -Djava.security.egd=file:/dev/./urandom -jar Controller.jar
/opt/SecureSpan/JDK/bin/java -Djava.security.egd=file:/dev/./urandom -jar Controller.jar
/sbin/mingetty /dev/tty1
....

This allows matching against arguments not just the base executable itself this is especially useful if you have many java applications but want to check for specific applications

# perl processAvailability.pl -match Controller.jar
<metric type="IntCounter" name="RunningProcesses|Controller.jar:Count" value="3" />
# perl processAvailability.pl -match java
<metric type="IntCounter" name="RunningProcesses|java:Count" value="10" />

The plugin is described in the documentation here