7.4.4 Example of collecting user-specific performance data (for a logical host environment)
The table below describes an example of collecting process information into the PI_UPI record. In a logical host environment, if you include name information about the host on which user commands are executed, you can easily tell which node a command is executed on.
Option |
Explanation |
Corresponding field |
Value |
---|---|---|---|
tt |
Transaction type |
Trans Type |
TotalMemory |
ki |
Transaction key (numeric type) |
Trans Data Key |
Process ID |
ss |
16-byte character string |
User String 1 |
Process name |
u |
Unsigned long type |
User Unsigned Long 1 |
Memory usage |
sm |
32-byte character string |
User String 5 |
Host name |
- Organization of this subsection
(1) Examples of user commands (for a logical host environment)
The following is an example of user commands (userapplication_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 sm" ps -eo pid,comm,vsz,rss | grep jpcagtu | awk '{ printf("TotalMemory %d %s %d '`uname -n`'\n",$1,$2,$3+$4);}'
The following is the user-created data when user commands (userapplication_script) are executed.
Example of user-created data output by userapplication_script:
Product Name=PFM-Agent for Platform (UNIX) FormVer=0001 tt ki ss u sm TotalMemory 0 COMMAND 0 jp1-aop TotalMemory 0 sched 0 jp1-aop TotalMemory 1 /etc/init 1584 jp1-aop TotalMemory 2 pageout 0 jp1-aop TotalMemory 3 fsflush 0 jp1-aop TotalMemory 442 /usr/lib/saf/sac 2808 jp1-aop :
- Note
-
-
For an example of collecting information about used ports, see 3.1.6 Examples of collecting information about used ports.
-
For an example of collecting performance data from multiple hosts on which PFM products are not installed, see 3.1.7 Examples of collecting performance data from multiple hosts on which PFM products are not installed.
-
(2) Example of a shell script used to perform periodic collection (for a logical host environment)
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 /jp1/userdata/perfdata.txt # Generate user-created data. /jp1/userdata/userapplication_script >> /jp1/userdata/perfdata.txt # Use the jpcuser command to convert the data. /opt/jp1pc/agtu/agent/jpcuser/jpcuser PD_UPD -file /jp1/userdata/perfdata.txt -lhost jp1-halaop#
- #
-
If -debug 2 is specified, debug log information is output to the following directory:
environment-directory/jp1pc/agtu/agent/jpcuser/debug/
- Note
-
The following example sets the shell script to be executed every minute, by using the UNIX cron command.
* * * * * /opt/UserDefinedData.sh