Linux Script to collect some agent statistics for support

book

Article ID: 208851

calendar_today

Updated On:

Products

CA Release Automation - Release Operations Center (Nolio)

Issue/Introduction

To collect some agent statistic, please follow below steps

Environment

Release : 6.6, 6.7 or higher

Component : CA RELEASE AUTOMATION RELEASE OPERATIONS CENTER

OS: Linux only

Resolution

1: Create a file agent_stats.sh on any directory on agent machine

2: Open the file in edit mode and copy and paste below text

#!/bin/bash

echo "Will be collecting stats of agent for support"
echo "Please key in RA agent install directory: "
read installdir
echo "Please key in ouput directory: "
read outdir

processout=$outdir/support_ps-ef.out
networkout=$outdir/support_netstat-aonp.out
dirlistout=$outdir/support_ls-laR.out
tarout=$outdir/support_agentStats.tar.gz

agentPid=$(cat $installdir/NolioAgent.pid)
lsofout=$outdir/support_wrapper_$agentPid.lsof.out
echo "Agent PID is $agentPid"
echo "listing open files for $agentPid, output file: $lsofout"
lsof -p $agentPid > $lsofout
echo "Capture process output: ps -ef > $processout"
ps -ef > $processout
echo "Capture network stats: netstat -aonp > $networkout"
netstat -aonp > $networkout
echo "Recurrsive directory listing: ls -laR $installdir > $dirlistout"
ls -laR $installdir > $dirlistout
echo -e  "Compressing agent stats \n \t 1:$lsofout \n \t 2:$processout\n \t 3:$networkout\n \t 4:$dirlistout"
tar -czf $tarout $lsofout $processout $networkout $dirlistout
echo -e "\n-------------------------------------------------------------------------\n Compressed Agent stats to tar $tarout \n"
echo -e "Run below command to remove status file:\n 1: rm -f $lsofout $processout $networkout $dirlistout \n 2: rm -f $tarout\n"

3: Save the file

4: Grant permission to this file using command chmod a+x agent_stats.sh

5: Execute the file ./agent_stats.sh (Please run it as RA User or other privilege's user like root). 

Sample output run

It will be creating a support_agentStats.tar.gz in the output directory, please share the same on support ticket.

 

Additional Information

agent_stats.sh file is attached to this KB.

Attachments

1613712140928__agent_stats.sh get_app