La commande 'netpmon' permet de suivre l'activité réseau d'un serveur.
Cette commande s'exécute en arrière plan et il faut alors utiliser 'trcstop' pour pouvoir interompre la récupération de traces.
Un exemple de lancement simple :
# netpmon
Run trcstop command to signal end of trace.
Fri Feb 20 11:32:00 2015
System: AIX 7.1 Node: ServerNim1 Machine: 00C800004C00
...
# trcstop
========================================================================
Process CPU Usage Statistics:
-----------------------------
Network
Process (top 20) PID CPU Time CPU % CPU %
----------------------------------------------------------
netpmon 66912446 3.3532 49.301 0.000
nfsd 4194444 0.0031 0.046 0.046
swapper 0 0.0028 0.041 0.000
getty 54788292 0.0027 0.040 0.000
sshd: 49610804 0.0019 0.028 0.001
trcstop 6422870 0.0019 0.028 0.000
ksh 64290886 0.0015 0.023 0.000
gil 1310760 0.0014 0.021 0.021
java 5570748 0.0011 0.016 0.000
syslet 5374142 0.0006 0.009 0.000
clcomd 8323086 0.0005 0.008 0.000
xmgc 983070 0.0005 0.007 0.000
netpmon 65863806 0.0005 0.007 0.000
rmcd 9437260 0.0005 0.007 0.000
netpmon 6422868 0.0004 0.006 0.000
rpc.lockd 8519726 0.0003 0.005 0.000
aso 4784282 0.0003 0.004 0.000
netpmon 52232262 0.0002 0.003 0.000
sendmail: 3801216 0.0002 0.003 0.000
reaffin 589842 0.0001 0.002 0.000
----------------------------------------------------------
Total (all processes) 3.3742 49.610 0.067
Idle time 2.3677 34.811
========================================================================
First Level Interrupt Handler CPU Usage Statistics:
---------------------------------------------------
Network
FLIH CPU Time CPU % CPU %
----------------------------------------------------------
UNKNOWN 0.0133 0.196 0.000
data page fault 0.0021 0.031 0.000
PPC decrementer 0.0013 0.019 0.000
external device 0.0001 0.001 0.000
instruction page fault 0.0000 0.001 0.000
queued interrupt 0.0000 0.000 0.000
----------------------------------------------------------
Total (all FLIHs) 0.0168 0.247 0.000
========================================================================
TCP Socket Call Statistics (by Process):
----------------------------------------
------ Read ----- ----- Write -----
Process (top 20) PID Calls/s Bytes/s Calls/s Bytes/s
------------------------------------------------------------------------
sshd: 49610804 0.86 14024 0.86 77
------------------------------------------------------------------------
Total (all processes) 0.86 14024 0.86 77
========================================================================
Detailed TCP Socket Call Statistics (by Process):
-------------------------------------------------
PROCESS: sshd: PID: 49610804
reads: 11
read sizes (bytes): avg 16384.0 min 16384 max 16384 sdev 0.0
read times (msec): avg 0.006 min 0.005 max 0.008 sdev 0.001
writes: 11
write sizes (bytes): avg 90.2 min 64 max 128 sdev 29.2
write times (msec): avg 0.013 min 0.011 max 0.017 sdev 0.002
PROTOCOL: TCP (All Processes)
reads: 11
read sizes (bytes): avg 16384.0 min 16384 max 16384 sdev 0.0
read times (msec): avg 0.006 min 0.005 max 0.008 sdev 0.001
writes: 11
write sizes (bytes): avg 90.2 min 64 max 128 sdev 29.2
write times (msec): avg 0.013 min 0.011 max 0.017 sdev 0.002
2658140 Missed Entries found
[netpmon: Reporting completed]
[ 4 traced cpus ]
[ 44.603 secs total preempt time ]
[netpmon: 12.851 secs in measured interval]
Ou bien
# netpmon -T 200000 -o /tmp/netpmon.out # Trace stockée dans un fichier précis.
Une fois la période passée, il faut donc lancer 'trcstop' pour récupérer les statistiques sur l'activité NFS.
Ci-dessous la documentation officielle IBM en V7.
netpmon Command
Purpose
Monitors activity and reports statistics on network I/O and network-related CPU usage.
Syntax
netpmon[-oFile] [-d] [-Tn] [-P] [-t] [-v][-rPURR] [-OReportType...] [-iTrace_File-nGensyms_File] [-@[WparList|ALL] ]
Description
Thenetpmoncommand monitors a trace of system events, and reports on network activity and performance during the monitored interval. By default, thenetpmoncommand runs in the background while one or more application programs or system commands are being executed and monitored. Thenetpmoncommand automatically starts and monitors a trace of network-related system events in real time. By default, the trace is started immediately; optionally, tracing may be deferred until the user issues atrconcommand. When tracing is stopped by atrcstopcommand, thenetpmoncommand generates all specified reports and exits.
Thenetpmoncommand can also work in offline mode, that is, on a previously generated trace file. In this mode, a file generated by thegensymscommand is also required. The gensyms file should be generated immediately after the trace has been stopped, and on the same machine. When running in offline mode, thenetpmoncommand cannot recognize protocols used by sockets, which limits the level of detail available in the socket reports.
Thenetpmoncommand reports on the following system activities:
CPU Usage
Thenetpmoncommand monitors CPU usage by all threads and interrupt handlers. It estimates how much of this usage is due to network-related activities.
Network Device-Driver I/O
Thenetpmoncommand monitors I/O operations through token-ring and Fiber-Distributed Data Interface (FDDI) network device drivers. In the case of transmission I/O, the command also monitors utilizations, queue lengths, and destination hosts. For receive ID, the command also monitors time in the demux layer.
Internet Socket Calls
Thenetpmoncommand monitors allsend,recv,sendto,recvfrom,read, andwritesubroutines on Internet sockets. It reports statistics on a per-process basis, for each of the following protocol types:
- ·Internet Control Message Protocol (ICMP)
- ·Transmission Control Protocol (TCP)
- ·User Datagram Protocol (UDP)
NFS I/O
Thenetpmoncommand monitorsreadandwritesubroutines on client Network File System (NFS) files, client NFS remote procedure call (RPC) requests, and NFS server read or write requests. The command reports subroutine statistics on a per-process or optional per-thread basis and on a per-file basis for each server. Thenetpmoncommand reports client RPC statistics for each server, and server read and write statistics for each client.
Any combination of the preceding report types can be specified with the command line flags. By default, all the reports are produced.
Notes:The reports produced by thenetpmoncommand can be quite long. Consequently, the-oflag should usually be used to write the report to an output file.Thenetpmoncommand obtains performance data using the system trace facility. The trace facility only supports one output stream. Consequently, only onenetpmonortraceprocess can be active at a time. If anothernetpmonortraceprocess is already running, thenetpmoncommand responds with the message:
/dev/systrace: Device busy
While monitoring very network-intensive applications, thenetpmoncommand may not be able to consume trace events as fast as they are produced in real time. When that happens, the error message:
Trace kernel buffers overflowed, N missed entries
displays on standard error, indicating how many trace events were lost while the trace buffers were full. Thenetpmoncommand continues monitoring network activity, but the accuracy of the report diminishes by some unknown degree. One way to avoid overflow is to increase the trace buffer size using the-Tflag, to accommodate larger bursts of trace events before overflow. Another way to avoid overflow problems all together is to run netpmon in offline mode.
When running in memory-constrained environments (where demand for memory exceeds supply), the-Pflag can be used to pin the text and data pages of the real-timenetpmonprocess in memory so the pages cannot be swapped out. If the-Pflag is not used, allowing thenetpmonprocess to be swapped out, the progress of thenetpmoncommand may be delayed such that it cannot process trace events fast enough to prevent trace buffer overflow.
If the/unixfile and the running kernel are not the same, the kernel addresses will be incorrect, causing thenetpmoncommand to exit.
Flags
Item |
Description |
-d |
Starts thenetpmoncommand, but defers tracing until thetrconcommand has been executed by the user. By default, tracing is started immediately. |
-iTrace_File |
Reads trace records from the fileTrace_Fileproduced with thetracecommand instead of a live system. The trace file must be rewritten first in raw format using thetrcpt -rcommand. This flag cannot be used without the-nflag. |
-nGensyms_File |
Reads necessary mapping information from the fileGensyms_Fileproduced by thegensymscommand. This flag is mandatory when the-iflag is used. |
-oFile |
Writes the reports to the specifiedFile, instead of to standard output. |
-OReportType ... |
Produces the specified report types. Valid report type values are: cpu CPU usage dd Network device-driver I/O. This report is not available inside a workload partition (WPAR) in online mode or in the global WPAR with the '-@WparList' flag. so Internet socket call I/O nfs NFS I/O (any version) nfs2 NFS Version 2 I/O nfs3 NFS Version 3 I/O nfs4 NFS Version 4 I/O all All reports are produced. This is the default value when thenetpmoncommand is run in the global WPAR without the-@flag. |
-P |
Pins monitor process in memory. This flag causes thenetpmontext and data pages to be pinned in memory for the duration of the monitoring period. This flag can be used to ensure that the real-timenetpmonprocess does not run out of memory space when running in a memory-constrained environment. |
-r PURR |
Uses PURR time instead of TimeBase in percent and CPU time calculation. Elapsed time calculations are unaffected. |
-t |
Prints CPU reports on a per-thread basis. |
-Tn |
Sets the kernel's trace buffer size tonbytes. The default size is 64000 bytes. The buffer size can be increased to accommodate larger bursts of events, if any. (A typical event record size is on the order of 30 bytes.) Note:The trace driver in the kernel uses double buffering, so actually two buffers of sizenbytes will be allocated. These buffers are pinned in memory, so they are not subject to paging. |
-v |
Prints extra information in the report. All processes and all accessed remote files are included in the report instead of only the 20 most active processes and files. |
-@[WparList|ALL] |
Specifies that reports are limited to the list of WPARs that are passed as an argument. |
Reports
The reports generated by thenetpmoncommand begin with a header, which identifies the date, the machine ID, and the length of the monitoring period in seconds. This is followed by a set of summary and detailed reports for all specified report types.
CPU Usage Reports
Process CPU Usage Statistics:Each row describes the CPU usage associated with a process. Unless the verbose option is specified, only the 20 most active processes are listed. At the bottom of the report, CPU usage for all processes is totaled, and CPU idle time is reported.
Process
Process name
PID
Process ID number
CPU Time
Total amount of CPU time used by this process
CPU %
CPU usage for this process as a percentage of total time
Network CPU %
Percentage of total time that this process spent executing network-related code
Thread CPU Usage Statistics
If the-tflag is used, each process row described above is immediately followed by rows describing the CPU usage of each thread owned by that process. The fields in these rows are identical to those for the process, except for the name field. (Threads are not named.)
First-Level Interrupt Handler Usage Statistics:Each row describes the CPU usage associated with a first-level interrupt handler (FLIH). At the bottom of the report, CPU usage for all FLIHs is totaled.
FLIH
First-level interrupt handler description
CPU Time
Total amount of CPU time used by this FLIH
CPU %
CPU usage for this interrupt handler as a percentage of total time
Network CPU %
Percentage of total time that this interrupt handler executed on behalf of network-related events
Second-Level Interrupt Handler Usage Statistics:Each row describes the CPU usage associated with a second-level interrupt handler (SLIH). At the bottom of the report, CPU usage for all SLIHs is totaled.
SLIH
Second-level interrupt handler description
CPU Time
Total amount of CPU time used by this SLIH
CPU %
CPU usage for this interrupt handler as a percentage of total time
Network CPU %
Percentage of total time that this interrupt handler executed on behalf of network-related events
Summary Network Device-Driver Reports
Network Device-Driver Statistics (by Device):Each row describes the statistics associated with a network device.
Device
Path name of special file associated with device
Xmit Pkts/s
Packets per second transmitted through this device
Xmit Bytes/s
Bytes per second transmitted through this device
Xmit Util
Busy time for this device, as a percent of total time
Xmit Qlen
Number of requests waiting to be transmitted through this device, averaged over time, including any transaction currently being transmitted
Recv Pkts/s
Packets per second received through this device
Recv Bytes/s
Bytes per second received through this device
Recv Demux
Time spent in demux layer as a fraction of total time
Network Device-Driver Transmit Statistics (by Destination Host):Each row describes the amount of transmit traffic associated with a particular destination host, at the device-driver level.
When hosts are on the same subnet, the destination host name is displayed. When hosts are in a different subnet, the destination host can be bridges, routers, or gateways as resolved by ARP protocol.
Host
Destination host name. An * (asterisk) is used for transmissions for which no host name can be determined.
Pkts/s
Packets per second transmitted to this host
Xmit Bytes/s
Bytes per second transmitted to this host
Summary Internet Socket Reports
- On-line mode:Socket Call Statistics for Each Internet Protocol (by Process): Each row describes the amount ofread/writesubroutine activity on sockets of this protocol type associated with a particular process. Unless the verbose option is specified, only the top 20 processes are listed. At the bottom of the report, all socket calls for this protocol are totaled.
- Off-line mode:Socket Call Statistics for Each Process: Each row describes the amount ofread/writesubroutine activity on sockets associated with a particular process. Unless the verbose option is specified, only the top 20 processes are listed. At the bottom of the report, all socket calls are totaled.
Process
Process name
PID
Process ID number
Read Calls/s or Read Ops/s
Number ofread,recv, andrecvfromsubroutines per second made by this process on sockets of this type
Read Bytes/s
Bytes per second requested by the above calls
Write Calls/s or Write Ops/s
Number ofwrite,send, andsendtosubroutines per second made by this process on sockets of this type
Write Bytes/s
Bytes per second written by this process to sockets of this protocol type
Summary NFS Reports
NFS Client Statistics for Each Server (by File):Each row describes the amount ofread/writesubroutine activity associated with a file mounted remotely from this server. Unless the verbose option is specified, only the top 20 files are listed. At the bottom of the report, calls for all files on this server are totaled.
File
Simple file name
Read Calls/s or Read Ops/s
Number ofreadsubroutines per second on this file
Read Bytes/s
Bytes per second requested by the above calls
Write Calls/s or Write Ops/s
Number ofwritesubroutines per second on this file
Write Bytes/s
Bytes per second written to this file
NFS Client RPC Statistics (by Server):Each row describes the number of NFS remote procedure calls being made by this client to a particular NFS server. At the bottom of the report, calls for all servers are totaled.
Server
Host name of server. An * (asterisk) is used for RPC calls for which no hostname could be determined.
Calls/s or Ops/s
Number of NFS RPC calls per second being made to this server.
NFS Client Statistics (by Process):Each row describes the amount of NFSread/writesubroutine activity associated with a particular process. Unless the verbose option is specified, only the top 20 processes are listed. At the bottom of the report, calls for all processes are totaled.
Process
Process name
PID
Process ID number
Read Calls/s or Read Ops/s
Number of NFSreadsubroutines per second made by this process
Read Bytes/s
Bytes per second requested by the above calls
Write Calls/s or Write Ops/s
Number of NFSwritesubroutines per second made by this process
Write Bytes/s
Bytes per second written to NFS mounted files by this process
NFS Server Statistics (by Client):Each row describes the amount of NFS activity handled by this server on behalf of particular client. At the bottom of the report, calls for all clients are totaled.
Client
Host name of client
Read Calls/s or Read Ops/s
Number of remote read requests per second processed on behalf of this client
Read Bytes/s
Bytes per second requested by this client's read calls
Write Calls/s or Write Ops/s
Number of remote write requests per second processed on behalf of this client
Write Bytes/s
Bytes per second written by this client
Other Calls/s or Ops/s
Number of other remote requests per second processed on behalf of this client
Detailed Reports
Detailed reports are generated for any of the specified report types. For these report types, a detailed report is produced for most of the summary reports. The detailed reports contain an entry for each entry in the summary reports with statistics for each type of transaction associated with the entry.
Transaction statistics consist of a count of the number of transactions of that type, followed by response time and size distribution data (where applicable). The distribution data consists of average, minimum, and maximum values, as well as standard deviations. Roughly two-thirds of the values are betweenaverage - standard deviationandaverage + standard deviation. Sizes are reported in bytes. Response times are reported in milliseconds.
Detailed Second Level Interrupt Handler CPU Usage Statistics:
SLIH
Name of second-level interrupt handler
Count
Number of interrupts of this type
CPU Time (Msec)
CPU usage statistics for handling interrupts of this type
Detailed Network Device-Driver Statistics (by Device):
Device
Path name of special file associated with device
Recv Packets
Number of packets received through this device
Recv Sizes (Bytes)
Size statistics for received packets
Recv Times (msec)
Response time statistics for processing received packets
Xmit Packets
Number of packets transmitted to this host
Demux Times (msec)
Time statistics for processing received packets in the demux layer
Xmit Sizes (Bytes)
Size statistics for transmitted packets
Xmit Times (Msec)
Response time statistics for processing transmitted packets
Detailed Network Device-Driver Transmit Statistics (by Host):
Host
Destination host name
Xmit Packets
Number of packets transmitted through this device
Xmit Sizes (Bytes)
Size statistics for transmitted packets
Xmit Times (Msec)
Response time statistics for processing transmitted packets
Detailed Socket Call Statistics for Each Internet Protocol (by Process): (on-linemode)Detailed Socket Call Statistics for Each Process: (off-linemode)
Process
Process name
PID
Process ID number
Reads
Number ofread,recv,recvfrom, andrecvmsgsubroutines made by this process on sockets of this type
Read Sizes (Bytes)
Size statistics forreadcalls
Read Times (Msec)
Response time statistics forreadcalls
Writes
Number ofwrite,send,sendto, andsendmsgsubroutines made by this process on sockets of this type
Write Sizes (Bytes)
Size statistics forwritecalls
Write Times (Msec)
Response time statistics forwritecalls
Detailed NFS Client Statistics for Each Server (by File):
File
File path name
Reads
Number of NFSreadsubroutines for this file
Read Sizes (Bytes)
Size statistics forreadcalls
Read Times (Msec)
Response time statistics forreadcalls
Writes
Number of NFSwritesubroutines for this file
Write Sizes (Bytes)
Size statistics forwritecalls
Write Times (Msec)
Response time statistics forwritecalls
Detailed NFS Client RPC Statistics (by Server):
Server
Server host name
Calls
Number of NFS client RPC calls made to this server
Call Times (Msec)
Response time statistics for RPC calls
Detailed NFS Client Statistics (by Process):
Process
Process name
PID
Process ID number
Reads
Number of NFSreadsubroutines made by this process
Read Sizes (Bytes)
Size statistics forreadcalls
Read Times (Msec)
Response time statistics forreadcalls
Writes
Number of NFSwritesubroutines made by this process
Write Sizes (Bytes)
Size statistics forwritecalls
Write Times (Msec)
Response time statistics forwritecalls
Detailed NFS Server Statistics (by Client):
Client
Client host name
Reads
Number of NFS read requests received from this client
Read Sizes (Bytes)
Size statistics for read requests
Read Times (Msec)
Response time statistics for read requests
Writes
Number of NFS write requests received from this client
Write Sizes (Bytes)
Size statistics for write requests
Write Times (Msec)
Response time statistics for write requests
Other Calls
Number of other NFS requests received from this client
Other Times (Msec)
Response time statistics for other requests
Examples
- To monitor network activity during the execution of certain application programs and generate all report types, type:
2.
netpmon
3.
<run application programs and commands here>
trcstop
Thenetpmoncommand automatically starts the system trace and puts itself in the background. Application programs and system commands can be run at this time. After thetrcstopcommand is issued, all reports are displayed on standard output.
- To generate CPU and NFS report types and write the reports to thenmon.outfile, type:
5.
netpmon -o nmon.out -O cpu,nfs
6.
<run application programs and commands here>
trcstop
Thenetpmoncommand immediately starts the system trace. After thetrcstopcommand is issued, the I/O activity report is written to thenmon.outfile. Only the CPU and NFS reports will be generated.
- To generate all report types and write verbose output to thenmon.outfile, type:
8.
netpmon -v -o nmon.out
9.
<run application programs and commands here>
trcstop
With the verbose output, thenetpmoncommand indicates the steps it is taking to start up the trace. The summary and detailed reports include all files and processes, instead of just the 20 most active files and processes.
- To use thenetpmoncommand in offline mode, type:
11.
trace -a
12.
run application programs and commands here
13.
trcoff
14.
gensyms > gen.out
15.
trcstop
netpmon -i tracefile -n gen.out -o netpmon.out