6.4.3 Example of collecting user-specific performance data

This subsection provides an example of collecting process information under the conditions shown in the following table.

Table 6-24 Conditions for collecting performance data in the example

OptionExplanationCorresponding fieldValue
ttTransaction typeTrans TypeTotalMemory
kiTransaction key (numeric type)Trans Data KeyProcess ID
ssShort stringUser String 1Process name
uUnsigned long typeUser Unsigned Long 1Amount of memory in use
Organization of this subsection
(1) Examples of user commands
(2) Example of a shell script used to perform periodic collection

(1) Examples of user commands

The following are examples of user commands (userapplication_script and userdata_script) that acquire process information from UNIX and output user-created data.

userapplication_script:

#!/bin/ksh
echo "Product Name=PFM-Agent for Platform (UNIX)"
echo "FormVer=0001"
echo "tt ki ss u"
ps -eo pid,comm,vsz,rss | grep jpcagtu | awk '{ printf("TotalMemory %d %s %d\n",$1,$2,$3+$4);}'

userdata_script:

#!/bin/ksh
echo "Product Name=PFM-Agent for Platform (UNIX)"
echo "FormVer=0001
"echo "tt ks u u"
df -k |grep pshp02 |awk '{ printf("RemoteDisk %s %d %d\n",$6,$3,$4);}'

The following are examples of user-created data output by the user commands above.

Example of user-created data output by userapplication_script:

Product Name=PFM-Agent for Platform (UNIX)
FormVer=0001
tt ki ss u
TotalMemory 0 COMMAND 0
TotalMemory 0 sched 0
TotalMemory 1 /etc/init 1584
TotalMemory 2 pageout 0
TotalMemory 3 fsflush 0
TotalMemory 442 /usr/lib/saf/sac 2808
 ...

Example of user-created data output by userdata_script:

Product Name=PFM-Agent for Platform (UNIX)
FormVer=0001
tt ks u u
RemoteDisk /home1/jp1ps 67318256 4473056
RemoteDisk /home2/jp1ps 43867064 27738672
 ...

Reference note

(2) Example of a shell script used to perform periodic collection

The following gives an example of a shell script (UserDefinedData.sh) for using functionality for periodically executing user commands.

# Delete old user-created data.
rm -Rf  /opt/perfdata.txt /opt/userdata.txt
# Generate user-created data.
/opt/userapplication_script >> /opt/perfdata.txt
/opt/userdata_script >> /opt/userdata.txt
# Use the jpcuser command to convert the data.
/opt/jp1pc/agtu/agent/jpcuser/jpcuser PD_UPD -file /opt/perfdata.txt -file /opt/userdata.txt#

#: If -debug 2 is specified, debug log information is output to the following directory:

/opt/jp1pc/agtu/agent/jpcuser/debug/

Reference note
The following example sets the shell script to be executed at every one minute using the UNIX cron command.
* * * * * /opt/UserDefinedData.sh