3.1.8 Examples of collecting information about used ports
PFM - Agent for Platform provides functionality to convert user-specific performance data output by users to text files (user-created data) into a format that can be stored in records provided by PFM - Agent for Platform (user data files). For details about user-specific performance data, see 6.8 Settings for collecting user-specific performance data.
The following shows an example for collecting used port information in PI_UPIB records as user-specific performance data. The following table describes the format in which used port information is stored.
Option |
Value |
---|---|
tt |
TCP |
ks |
The host name |
lr |
The total number of TCP ports for the host |
lr |
The number of currently active TCP ports for the host |
lr |
The number of listening TCP ports for the host |
To collect information:
-
Create a batch operation for collecting information about used ports.
In this example, a batch operation is used to collect information about used ports, as shown below.
Batch creation example (D:\homework\sample.bat):
@echo off echo Product Name=PFM-Agent for Platform (Windows) > D:\homework\userdata.tcp echo FormVer=0001 >> D:\homework\userdata.tcp echo tt ks lr lr lr >> D:\homework\userdata.tcp hostname > D:\homework\userdata.tmp netstat -ap tcp | find "TCP" /C >> D:\homework\userdata.tmp netstat -ap tcp | find "ESTABLISHED" /C >> D:\homework\userdata.tmp netstat -ap tcp | find "LISTENING" /C >> D:\homework\userdata.tmp ( set /p ks= set /p lr1= set /p lr2= set /p lr3= ) < D:\homework\userdata.tmp del D:\homework\userdata.tmp echo TCP %ks% %lr1% %lr2% %lr3% >> D:\homework\userdata.tcp
- Important
-
The batch programs shown here might not operate, depending on the environment.
-
Execute the batch operation created in step 1.
The following shows the user-created data created as a result of batch execution.
User-created data (D:\homework\userdata.tcp):
Product Name=PFM-Agent for Platform (Windows) FormVer=0001 tt ks lr lr lr TCP jp1ps05 15 3 12
-
Convert the user-created data created in step 2 to a user data file.
The following shows example of executing the jpcuser command to convert user-created data into a user data file.
Example of jpcuser command execution:
"C:\Program Files (x86)\HITACHI\jp1pc\agtt\agent\jpcuser\jpcuser" PI_UPIB -file D:\homework\userdata.tcp
-
Use PFM - Agent for Platform to collect the user data file output in step 3.
When PFM - Agent for Platform collects records, the contents of the user data file are stored in user records.