In addition to Weibo, there is also WeChat
Please pay attention
WeChat public account
Shulou
2025-01-19 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Servers >
Share
Shulou(Shulou.com)06/01 Report--
This article mainly explains "the usage of the Linux basic command sar". Interested friends may wish to have a look. The method introduced in this paper is simple, fast and practical. Let's let the editor take you to learn the usage of the basic Linux command sar.
Sar
The sar instruction is used to collect, report, and save information about the activity of the system. The sar command writes the contents of the selected cumulative activity counter in the operating system to standard output. The accounting system writes information about the specified number of times of a specified interval in seconds according to the values in the parameters "interval" and "count". If the parameter "interval" is set to zero, the sar command displays the average statistics since the system was started. If you specify the "count" parameter but not the "Interval" parameter, reports are generated continuously. In addition to displaying it on the screen, you can save the collected data in the file specified by the "- o" flag. If the filename is omitted, sar uses the standard system activity day data file "/ var/log/sa/sadd" file, where the dd parameter indicates the current date. By default, all available data in the kernel is saved in a data file.
The sar command extracts and writes standard output records that were previously saved in the file. This file can be the file specified by the "- f" flag, or it can be the default standard system activity day data file.
If there is no "- P" flag, the sar command reports system-wide statistics (global statistics in all processors), which are calculated as the average of the values expressed as a percentage and the sum as otherwise. Given the "- P" flag, the sar command reports activity related to the specified processor. If "- P ALL" is given, the sar command reports statistics for each processor and global statistics between all processors.
You can use flags to select information about specific system activities. No flags are specified, only CPU activities are selected. Specifying the-A flag is equivalent to specifying "- bBdqrRSvwWy-I SUM-I XALL-n ALL-u ALL-P ALL".
The default version of the sar command (CPU utilization report) may be one of the first tools for users to start a system activity survey because it monitors major system resources. If the CPU utilization is close to 100% (using "+ nice + system"), the sampled workload is CPU limited.
If you need multiple examples and multiple reports, you can easily specify an output file for the sar command. Run the sar command as a background process. The syntax for this is:
Sar-o datafile interval count > / dev/null 2 > & 1 &
All data is captured in binary form and saved to a file (data file). You can then use the sar command to selectively display the data using the-f option. Set the interval and count parameters to select the count record for the interval second interval. If the Count parameter is not set, all records saved in the file are selected. Collecting data in this way is useful for describing system usage over a period of time and determining peak usage time.
Note: the sar command reports only local activity.
The scope of this command: RedHat, RHEL, Ubuntu, CentOS, Fedora, SUSE, openSUSE.
1. Grammar
Sar [options]
2. List of options
Option
Description
A
Show all reports
-b
Displays the IO status and transfer rate, with one of the following values:
Tps, the total number of transmissions sent to the physical device per second. The transport is an Istroke O request to the physical device. Multiple logical requests can be combined into a single Ipicuro request to the device. The transfer is of uncertain size.
Rtps, the total number of read requests made to the physical device per second.
Wtps, the total number of write requests made to the physical device per second.
Bread/s, the total amount of data read from the device per second, in blocks, with a block size of 512 bytes.
Bwrtn/s, the total amount of data written to the device per second, in blocks.
-B
Display page information:
Pgpgin/s, the total number of bytes called into the system from disk per second. Note: for the old kernel (2.2.x), this value is many blocks per second (not kilobytes).
Pgpgout/s, the total number of kilobytes that the system calls to disk per second. Note: for the old kernel (2.2.x), this value is several blocks per second (not kilobytes).
Fault/s, the number of page errors generated by the system per second (major minor errors). This is not the count of page errors that generate Iamp O, because some page errors can be resolved without Iamp O.
Majflt/s, the number of major failures per second of the system that require memory pages to be loaded from disk.
Pgfree/s, the number of pages the system places on the free list per second
Pgscank/s, the number of pages scanned by the kswapd daemon per second.
Pgscand/s, the number of pages directly scanned per second.
Pgsteal/s, the number of pages reclaimed from the cache (paging cache and swap cache) per second to meet memory requirements.
% vmeff, which is a measure of page recycling efficiency (pgsteal / pgscan). If it is close to 100%, then almost all pages coming down from the end of the inactive list will be captured. If it is too low (for example, less than 30%), then virtual memory will have some difficulties. If the page is not scanned during the interval, this field is displayed as zero.
-C
When reading the file, the comment information is displayed
-d
Displays block device information with the following values:
Tps, indicating the number of transmissions sent to the device per second. Multiple logical requests can be combined into a single Ipicuro request to the device. The transfer is of uncertain size.
Rd_sec/s, the number of sectors read from the device. The size of the sector is 512 bytes.
Wr_sec/s, the number of sectors written to the device. The size of the sector is 512 bytes.
Avgrq-sz, the average size of requests made to the device by sector.
Avgqu-sz, the average queue length of requests made to the device.
Await, the average time (in milliseconds) in which an Icano request was made to the device to be served. This includes the time the request spent in the queue and the time it took to serve them.
Svctm, the average service time (in milliseconds) of Istroke O requests made to the device.
% util, the percentage of CPU time (bandwidth utilization of the device) that made an Iramp O request to the device. When this value is close to 100%, device saturation occurs.
-e [hh:mm:ss]
Set the end time of the report
-f
Get information from a file
-h
Display short help messages
-I
Select the data record in seconds to be as close as possible to the number specified by the Interval parameter.
-I {int [,...] | SUM | ALL | XALL}
Reports statistics for a given interrupt. Int is the interrupt number. Specifying multiple INT parameters on the command line will view multiple separate interrupts. The SUM keyword indicates that the total number of interrupts received per second will be displayed. The ALL keyword indicates that statistics from the first 16 interrupts will be reported, while the XALL keyword indicates that statistics from all interrupts will be reported, including potential APIC interrupt sources. Note that the interruption statistics depend on the SADC option "- S INT" to be collected.
-j {ID | LABEL | PATH | UUID |.}
Displays the persistent device name. Use this option in conjunction with option-d. Options ID, LABEL, etc. Specifies the type of persistence name. These options are unrestricted, and the only prerequisite is that there is a directory with the desired persistent name in "/ dev/disk". If no persistent name is found for the device, the device name will be well printed (see option-p below).
-- legacy
Enable reading of old "/ var/log/sa/sadd" data files
-m
Report power management information
-n
Report network information, possible keywords are DEV,EDEV,NFS,NFSD,SOCK,IP,EIP,ICMP,EICMP,TCP,ETCP,UDP,SOCK6,IP6,EIP6,ICMP6,EICMP6,UDP6.
Using the DEV keyword, statistics from network devices are reported. The following values are displayed:
IFACE, the name of the network interface on which statistics are reported.
Rxpck/s, the total number of packets received per second.
Txpck/s, the total number of packets sent per second.
RxkB/s, the total number of kilobytes received per second
TxkB/s, total kilobytes sent per second
Rxcmp/s, the number of compressed packets received per second (for frequency hopping, etc.)
Txcmp/s, the number of compressed packets transmitted per second.
Rxmcst/s, the number of multicast packets received per second.
Using the EDEV keyword, failure (error) statistics from network devices are reported. The following values are displayed:
IFACE, the name of the network interface on which statistics are reported.
Rxerr/s, the total number of bad packets received per second.
Txerr/s, the total number of errors per second when sending packets.
Coll/s, the number of collisions per second that occurred while transmitting the packet.
Rxdrop/s, the number of packets dropped per second when received due to lack of space in the Linux buffer.
Txdrop/s, the number of packets dropped per second when sent due to lack of space in the Linux buffer.
Txcarr/s, the carrier error that occurs per second while transmitting the packet.
Rxfram/s, the number of frame alignment errors that occur on received packets per second.
Rxfifo/s, the number of FIFO overflow errors that occurred on received packets per second
Txfifo/s, the number of FIFO overflow errors that occurred on the transmitted packet per second.
Using the NFS keyword, statistics about NFS client activity are reported. The following values are displayed:
Call/s, the number of RPC requests made per second.
Retrans/s, the number of RPC requests per second, requests that need to be retransmitted (for example, due to server timeout).
Read/s, the number of "read" RPC calls made per second.
Write/s, the number of "write" RPC calls made per second.
Access/s, the number of "access" RPC calls made per second.
Getatt/s, the number of "getattr" RPC calls made per second.
Using the NFSD keyword, statistics about NFS server activity are reported. The following values are displayed:
Scall/s, the number of RPC requests received per second.
Badcall/s, the number of incorrect rpc requests received per second, which can result in errors in the processing of these requests.
Packet/s, the number of network packets received per second.
Udp/s, the number of udp packets received per second.
Tcp/s, the number of tcp packets received per second.
Hit/s, number of answer cache hits per second.
Miss/s, the number of times per second that the reply cache was missed.
Sread/s, the number of "read" RPC calls received per second.
Swrite/s, the number of "write" RPC calls received per second.
Saccess/s, the number of "access" RPC calls received per second.
Sgetatt/s, the number of "getattr" RPC calls received per second.
Using the Sock keyword, statistics on sockets in use are reported (IPv 4). The following values are displayed:
Totsck, the total number of sockets used by the system
Tcpsck, the number of TCP sockets currently in use
Udpsck, the number of UDP sockets currently in use
Rawsck, the number of RAW sockets currently in use
Ip-frag, the number of IP fragments currently in use
Tcp-tw, the number of TCP sockets in the waiting state.
Use the IP keyword to report statistics about IPv 4 network traffic. Note that IPv 4 statistics depend on the SADC option "- S SNMP" to be collected. Displays the following values (with the official SNMP name in square brackets):
Irec/s, the total number of input datagrams received from the interface per second, including incorrectly received datagrams [ipInReceives].
Fwddgm/s, enter the number of datagrams per second, the entity is not the entity's final IP destination, so try to find a route to forward it to that final destination [ipForwDatagram].
Idel/s, the total number of input datagrams successfully delivered to the IP user protocol (including ICMP) per second [ipInDelivers].
Orq/s, the total number of IP datagrams provided to IP by the local IP user protocol (including ICMP) per second when requesting transmission [ipOutRequest]. Note that this counter does not include any datagrams calculated in fwddgm/s.
Asmrq/s, the number of IP fragments received per second that need to be reassembled in this entity [ipReasmReqds].
Asmok/s, the number of IP datagrams successfully reassembled per second [ipReasmOKs].
Fragok/s, the number of IP datagrams successfully segmented in this entity per second [ipFragOKs].
Fragcrt/s, the number of IP Datagram fragments generated per second due to fragments of the entity [ipFragCreates].
Using the EIP keyword, statistics about IPv 4 network errors are reported. Note that IPv 4 statistics depend on the SADC option "- S SNMP" to be collected. Displays the following values (with the official SNMP name in square brackets):
Ihdrerr/s, the number of input datagrams discarded per second due to errors in the IP header, including error checksum, version number mismatch, other format errors, timeout, errors found while processing the IP option, and so on. [ipinHdrError]
Iadrerr/s, the number of input datagrams discarded per second because the IP address in the destination field of their IP header is not a valid address to be received by this entity. This count includes invalid addresses (for example, 0.0.0.0) and addresses of unsupported classes (for example, class E). For entities that are not IP routers and therefore do not forward datagrams, this counter includes discarded datagrams because the destination address is not a local address [ipInAddrError].
Iukwnpr/s, the number of locally addressed datagrams successfully received but discarded per second due to unknown or unsupported protocols [ipInUnKnownProtos].
Idisc/s, the number of IP datagrams entered per second, encountered no problems to prevent them from continuing processing, but these datagrams were discarded (for example, due to lack of buffer space) [ipInDis batches]. Note that this counter does not include any datagrams that are discarded while waiting for reassembly.
Odisc/s, the number of IP datagrams output per second, encountered no problems preventing them from being transmitted to the destination, but these datagrams were discarded (for example, due to lack of buffer space) [ipOutDisks]. Note that if any of these packets meet this (arbitrary) discard criteria, this counter will include datagrams counted in fwddgm/s.
Onort/s, the number of IP datagrams discarded per second because the route to the destination [ipOutNoRoutes] could not be found. Note that this counter includes any packets that meet the No routing criteria that are counted in the fwddgm/s. Note that this includes any datagrams that cannot be routed by the host because all of its default routers are down.
The number of failures detected by the asmf/s,IP reassembly algorithm per second (for whatever reason: timeout, error, etc.) [ipReasmFails].
Fragf/s, the number of IP datagrams discarded per second because they need to be fragmented in the entity, but cannot do so.
Use the ICMP keyword to report statistics about ICMPv 4 network traffic. Please note that the statistics for ICMPv 4 depend on the SADC option "- S SNMP" to be collected. Displays the following values (with the official SNMP name in square brackets):
Imsg/s, the total number of ICMP messages received by the entity per second [icmpInMsgs].
Omsg/s, the total number of ICMP messages the entity is trying to send per second [icmpOutMsgs].
Iech/s, number of ICMP Echo (request) messages received per second [icmpInEchos].
Iechr/s, the number of ICMP echo reply messages received per second [icmpInEchoRep].
Oech/s, the number of ICMP echo (request) messages sent per second [icmpOutEchos].
Oechr/s, the number of ICMP echo reply messages sent per second [icmpOutEchoRep].
Itm/s, the number of ICMP timestamp (request) messages received per second [icmpInTimestamps].
Itmr/s, the number of ICMP timestamp reply messages received per second [icmpInTimestampRep].
Otm/s, the number of ICMP timestamp (request) messages sent per second [icmpOut Timestamps]
Otmr/s, the number of ICMP timestamp reply messages sent per second [icmpOutTimestampRep].
Iadrmk/s, the number of ICMP address mask request messages received per second [icmpInAddrMask].
Iadrmkr/s, the number of ICMP address mask reply messages received per second [icmpInAddrMaskRep]
Oadrmk/s, the number of ICMP address mask request messages sent per second [icmpOutAddrMask]
Oadrmkr/s, the number of ICMP address mask reply messages sent per second [icmpOutAddrMaskRep].
Using the EICMP keyword, statistics about ICMPv 4 error messages are reported. Please note that the statistics for ICMPv 4 depend on the SADC option "- S SNMP" to be collected. Displays the following values (with the official SNMP name in square brackets):
Ierr/s, the number of ICMP messages received by the entity per second but determined to have ICMP specific errors (bad ICMP checksum, bad length, etc.) [icmpinError]
Oerr/s, the number of ICMP messages per second that the entity did not send due to problems found in ICMP, such as missing buffer [icmpOutError].
Idstunr/s, the number of ICMP destination unreachable messages received per second [icmpInDestUnreachs]
Odstunr/s, the number of ICMP destination unreachable messages sent per second [icmpOutDestUnreachs]
Itmex/s,ICMP time exceeds the number of messages received per second [icmpInTimeExcds]
The otmex/s,ICMP time exceeds the message sent per second [icmpOutTimeExcds].
Iparmpb/s, the number of ICMP parameter problem messages received per second [icmpInParmProbs]
Oparmpb/s, the number of ICMP parameter problem messages sent per second [icmpOutParmProbs].
Isrcq/s, the number of ICMP source Quench messages received per second [icmpInSrcQuengs].
Osrcq/s, the number of ICMP source Quench messages sent per second [icmpOutSrcQuenberg]
Iredir/s, the number of ICMP redirect messages received per second [icmpInRedirects].
Oredir/s, the number of ICMP redirect messages sent per second [icmpOutRedirections].
Using the TCP keyword, statistics about TCPv 4 network traffic are reported. Note that TCPv 4 statistics depend on the SADC option "- S SNMP" to be collected. Displays the following values (with the official SNMP name in square brackets):
The number of times per second that an active/s,tcp connection transitioned directly from the closed state to the SYN sent state [tcpActiveOpens]
The number of times the passive/s,tcp connection transitioned directly from the listening state to the SYN-RCVD state per second [tcpPassiveOpens]
Iseg/s, the total number of segments received per second, including the number of segments received in error [tcpInSegs]. This count includes segments received on the currently established connection.
Oseg/s, the number of segments sent per second, including the number of segments on the current connection, but does not include only the number of octets [tcpOutSegs] segments that are retransmitted.
Using the ETCP keyword, statistics about TCPv 4 network errors are reported. Note that TCPv 4 statistics depend on the SADC option "- S SNMP" to be collected. Displays the following values (with the official SNMP name in square brackets):
Atmptf/s, the number of TCP connections per second has been directly transferred from the SYN sent state or SYNRCVD state to the closed state, plus the number of TCP connections per second has directly transitioned from the SYN-RCVD state to the listening state [tcpAttemtFails].
Estres/s, how many TCP connections per second have transitioned directly from established state or closed wait state [tcpEstabResets] to closed state.
Retrans/s, the total number of retransmitted segments per second, that is, the number of TCP segments containing one or more previously transmitted octets [tcpRetransSegs].
Isegerr/s, total number of error segments received per second (for example, incorrect TCP checksum) [tcpInErrs]
Orsts/s, the number of TCP segments sent per second containing the RST flag [tcpOutRars].
Use the UDP keyword to report statistics about UDPv 4 network traffic. Note that UDPv 4 statistics depend on the SADC option "- S SNMP" to be collected. Displays the following values (with the official SNMP name in square brackets):
Idgm/s, total number of UDP datagrams sent to UDP users per second [udpInDatagram]
Odgm/s, the total number of UDP datagrams sent by the entity per second [udpOutDatagram]
Noport/s, the total number of UDP datagrams received per second with no application on the target port [udpNoport].
Idgmerr/s, the number of UDP datagrams received per second that cannot be delivered due to a lack of application [udpInError] on the destination port.
Using the SOCK6 keyword, statistics on sockets in use are reported (IPv 6). Please note that IPv 6 statistics depend on the SADC option "- S IPv 6" to be collected. The following values are displayed:
Tcp6sck, the number of TCPv6 sockets currently in use.
Udp6sck, the number of UDPv6 sockets currently in use
Raw6sck, the number of RAWv6 sockets currently in use
Ip6-frag, the number of ipv6 fragments currently in use
Use the IP6 keyword to report statistics about IPv 6 network traffic. Please note that IPv 6 statistics depend on the SADC option "- S IPv 6" to be collected. Displays the following values (with the official SNMP name in square brackets):
Irec6/s, the total number of input datagrams received from the interface per second, including incorrectly received datagrams [ipv6IfStatsInReceives].
Fwddgm6/s, the number of output datagrams per second received by the entity and forwarded to its final destination [ipv6IfStatsOutForwDatagram].
Idel6/s, the total number of datagrams successfully delivered to the IPv 6 user protocol (including ICMP) per second [ipv6IfStatsInDelivers].
Orq6/s, the total number of IPv 6 datagrams provided to IPv 6 per second by the local IPv 6 user protocol (including ICMP) in the transfer request [ipv6IfStatsOutRequest].
Asmrq6/s, the number of IPv 6 fragments received per second that need to be reassembled on this interface [ipv6IfStatsReasmReqds].
Asmok6/s, the number of IPv 6 datagrams successfully reassembled per second [ipv6IfStatsReasmOKs].
Imcpck6/s, the number of multicast packets received by the interface per second [ipv6IfStatsInMcastPkts].
Omcpck6/s, the number of multicast packets sent per second through the interface [ipv6IfStatsOutMcastPkts].
Fragok6/s, the number of IPv 6 datagrams successfully segmented on this output interface per second [ipv6IfStatsOutFragOKs]
Fragcr6/s, the number of output Datagram fragments generated per second as a result of [ipv6IfStatsOutFragCreates] segmentation in this output interface.
Use the EIP6 keyword to report statistics about IPv 6 network errors. Please note that IPv 6 statistics depend on the SADC option "- S IPv 6" to be collected. Show the following values (formal SNMP name between square brackets)
Ihdrer6/s, the number of input datagrams discarded per second due to errors in the IPv 6 header, including version number mismatches, other format errors, hop overruns, errors found while processing the IPv 6 option, and so on. [ipv6fStatsInHdrError] .
Iadrer6/s, the number of input datagrams discarded per second, because the IPv 6 address in the destination field of their IPv 6 header is not a valid address to be received by this entity. This count includes invalid addresses (for example: 0) and unsupported addresses (for example, addresses with unassigned prefixes). For entities that are not IPv 6 routers and therefore do not forward datagrams, this counter includes discarded datagrams because the destination address is not a local address [ipv6IfStatsInAddrError].
Iukwnp6/s, the number of locally addressed datagrams successfully received but discarded per second due to unknown or unsupported protocols [ipv6IfStatsIn unknown nProtos].
I2big6/s, the number of input datagrams that cannot be forwarded per second because its size exceeds the link MTU of the outgoing interface [ipv6IfStatsInTooBigError].
Idisc6/s, enter the number of IPv 6 datagrams per second, which do not encounter any problems to prevent them from continuing processing, but are discarded (for example, due to lack of buffer space) [ipv6IfStatsInDiscards].
Inort6/s, the number of input datagrams discarded per second because the route (Ipv6IfStatsInNoRoutes) to their destination [ipv6IfStatsInNoRoutes] could not be found.
Onort6/s, the number of locally generated IP datagrams discarded per second because the route to the destination [unknown formal SNMP name] could not be found.
The number of failures detected by the asmf6/s,IPv 6 reassembly algorithm per second (for whatever reason: timeout, error, etc.). [ipv6fStatsReasmFails] .
Fragf6/s, the number of IPv 6 datagrams discarded per second because they need to be fragmented on this output interface, but cannot be [ipv6IfStatsOutFragFails].
Itrpck6/s, the number of input datagrams discarded per second because the Datagram frame does not carry enough data [ipv6IfStatsInTruncatedPkts]
Using the ICMP6 keyword, reported statistics about ICMPv 6 network traffic. Please note that statistics for ICMPv 6 depend on the SADC option "- S IPv 6" to be collected. Displays the following values (with the official SNMP name in square brackets):
Imsg6/s, the total number of ICMP messages received by the interface per second, including all messages calculated by ierr6/s [ipv6IfIcmpInMsgs].
Omsg6/s, the total number of ICMP messages attempted by this interface per second [ipv6IfIcmpOutMsgs]
Iech7/s, the number of ICMP Echo (request) messages received by the interface per second [ipv6IfIcmpInEchos]
Iechr6/s, the number of ICMP echo reply messages received by the interface per second [ipv6IfIcmpInEchoReplies]
Oechr6/s, the number of ICMP Echo reply messages sent by the interface per second [ipv6IfIcmpOutEchoReplies].
Igmbq6/s, the number of ICMPv 6 group member query messages received by the API per second [ipv6IfIcmpInGroupMembQueries]
Igmbr6/s, the number of ICMPv 6 group membership response messages received by the interface per second [ipv6IfIcmpInGroupMembResponse].
Ogmbr6/s, the number of ICMPv 6 group membership response messages sent per second [ipv6IfIcmpOutGroupMembResponse]
Igmbrd6/s, the number of ICMPv 6 group members received by the interface per second reduces the number of messages [ipv6IfIcmpInGroupMembReductions].
Ogmbrd6/s, ICMPv 6 group membership reduction messages sent per second [ipv6IfIcmpOutGroupMembReductions]
The number of messages per second that the irtsol6/s,ICMP router requests the interface to receive [ipv6IfIcmpInRouterSolrice].
Ortsol6/s, the number of ICMP router request messages sent by the interface per second [ipv6IfIcmpOutRouterSolter].
Irtad6/s, the number of ICMP router ad messages received by the interface per second [ipv6IfIcmpInRouterAdvertisements].
Inbsol6/s, the number of ICMP neighbor request messages received by the interface per second [ipv6IfIcmpInNeighborSolrice].
Onbsol6/s, the number of ICMP neighbor request messages sent by the interface per second [ipv6IfIcmpOutNeighSolborSoleline].
Inbad6/s, the number of ICMP neighbor advertisement messages received by the interface per second [ipv6IfIcmpInNeighborAdvertisements].
Onbad6/s, the number of ICMP neighbor advertisement messages sent by the API per second [ipv6IfIcmpOutNeighborAdvertisements].
Use the EICMP6 keyword to report statistics about ICMPv 6 error messages. Please note that statistics for ICMPv 6 depend on the SADC option "- S IPv 6" to be collected. Displays the following values (with the official SNMP name in square brackets):
Ierr6/s, the number of ICMP messages per second received by the interface but determined to have ICMP-specific errors (bad ICMP checksum, bad length, etc.) [ipv6IcmpInError]
Idtunr6/s, the number of ICMP destination unreachable messages received by the interface per second [ipv6IfIcmpInDestUnreachs].
Odtunr6/s, the number of ICMP destination unreachable messages sent by the interface per second [ipv6IfIcmpOutDestUnreachs].
The itmex6/s,ICMP time exceeds the number of messages received by the interface per second [ipv6IfIcmpInTimeExcds].
The otmex6/s,ICMP time exceeds the number of messages sent by the interface per second [ipv6IfIcmpOutTimeExcds].
Iprmpb6/s, the number of ICMP parameter problem messages received by the interface per second [ipv6IfIcmpInParmProblems].
Oprmpb6/s, the number of ICMP parameter problem messages sent by the interface per second [ipv6IfIcmpOutParmProblems].
Iredir6/s, the number of redirected messages received by the interface per second [ipv6IfIcmpInRedirections].
Oredir6/s, the number of redirected messages sent by the interface for the second time [ipv6IfIcmpOutRedirections].
Ipck2b6/s, the number of ICMP packets received by the interface per second [ipv6IfIcmpInPktTooBigs].
Opck2b6/s, the number of ICMP packets sent by the interface per second [ipv6IfIcmpOutPktTooBigs].
Use the UDP6 keyword to report statistics about UDPv 6 network traffic. Please note that statistics for UDPv 6 depend on the SADC option "- S IPv 6" to be collected. Displays the following values (the formal SNMP name between square brackets):
Idgm6/s, the total number of UDP datagrams passed to UDP users per second [udpInDatagram].
Odgm6/s, the total number of UDP datagrams sent by the entity per second [udpOutDatagram].
Noport6/s, the total number of UDP datagrams received per second without an application on the target port [udpNoport].
Idgmer6/s, the number of UDP datagrams received per second, unable to pass [udpInError] due to a lack of applications on the destination port.
-o
Save content
-P
Report cpu usage
-p
Beautiful printing device name. Use this option in conjunction with option-d. By default, the name is printed as dev Mmurn, where m and n are the primary and secondary device numbers of the device.
-Q
Report queue length and load average:
Runq-sz, run queue length (number of tasks waiting to run)
Plist-sz, the number of tasks in the task list
Ldavg-1, average system load at the last minute. The load average is calculated as the average number of tasks that can be run or are running (R state), and the number of tasks that are in an uninterrupted sleep state (D state) during the specified interval.
Ldavg-5, average system load in the past 5 minutes.
Ldavg-15, average system load in the past 15 minutes.
-r
Report memory usage:
Kbmemfree, the amount of memory available (kilobytes).
Kbmemused, the amount of memory used in kilobytes. This does not take into account the memory used by the kernel itself.
% memused, percentage of memory used.
Kbbuffers, the amount of memory the kernel uses as a buffer (in kilobytes).
Kbcached, the amount of memory that the kernel caches data (in kilobytes)
Kbcommit, the amount of memory required by the current workload in kilobytes. This is an estimate of how much memory / swap is needed to ensure that memory is never exhausted.
% commit, as a percentage of the total memory (RAM swap) required by the current workload. This number may be greater than 100% because the kernel usually commits too much memory.
-R
Report memory statistics. Show the following values
Frmpg/s, the number of memory pages freed by the system per second. Negative values represent several pages assigned by the system. Note that depending on the machine architecture, the size of the page is 4kB or 8kB.
Bufpg/s, the number of additional memory pages used by the system as a buffer per second. A negative value means that fewer pages are used by the system as a buffer.
Campg/s, the number of other memory pages cached by the system per second. A negative value means fewer pages in the cache.
-s [hh:mm:ss]
Set data start time
-S
Report swap space utilization statistics:
Kbswpfree, the amount of free swap space (in kilobytes)
Kbswpused, the amount of swap space used (in kilobytes)
% swpused,Percentage of used swap space.
Kbswpcad, the amount of cache swapped memory in kilobytes. Once the memory is swapped, it will be swapped back, but it is still in the swap area (if memory is needed, it does not need to be swapped, because it is already in the swap area). This saves me a lot of money.
% swpcad, percentage of cache swap memory relative to the amount of swap space used
-t
When reading data from a daily data file, indicates that sar should display a timestamp within the original locale time of the creator of the data file. Without this option, the sar command displays a timestamp in the user's locale time.
-u [ALL]
Report CPU utilization. The ALL keyword indicates that all CPU fields should be displayed. The report can display the following fields:
% user, the percentage of CPU utilization that occurs when executing at the user level (application). Note that this field includes the time it takes to run the virtual processor.
% usr, the percentage of CPU utilization that occurs when executing at the user level (application). Note that this field does not include the time it takes to run the virtual processor.
% nice, the percentage of cpu utilization that occurs when executed at the user level with good priority
% system, the percentage of CPU utilization that occurs during system-level (kernel) execution. Note that this field includes the time used to service hardware and software outages.
% sys, the percentage of CPU utilization that occurs during system-level (kernel) execution. Note that this field does not include time spent serving hardware or software outages.
% percentage of time that iowait,CPU or CPU is idle, during which the system has outstanding disk Imaco requests.
% steal, the percentage of time that the virtual CPU or CPU spent involuntarily waiting while the hypervisor was serving another virtual processor
The percentage of time that irq,CPU or CPU spent serving hardware interrupts.
The percentage of time that soft,CPU or CPU spent serving software outages.
% guest,CPU or CPU percentage of time spent running virtual processors
The percentage of time that idle,CPU or CPU is idle and the system does not have a disk Imax O request that has not been executed.
-v
Report the status of inode, file, and other kernel tables. The following values are displayed:
Dentunusd, the number of unused cache entries in the directory cache.
File-nr, the number of file handles used by the system.
Inode-nr, the number of inode processors used by the system.
Pty-nr, the number of pseudo terminals used by the system.
-V
Print command version information and exit
-w
Report task creation and switching
-W
Report on swap space:
Pswpin/s, the total number of swap pages entered by the system per second
Pswpout/s, the total number of swap pages generated by the system per second
-y
Reports the condition of the tty device, showing the following values:
Rcvin/s, the number of interrupts received by the current serial line per second. The sequence number is given in the TTY column.
Xmtin/s, the number of interrupts sent by the current serial line per second.
Framerr/s, the number of frame errors per second on the current serial line.
Prtyerr/s, current serial line parity errors per second.
Brk/s, the number of outages per second on the current serial line.
Ovrun/s, current serial line overflow errors per second
3. Files
/ var/log/sa/sadd, indicating the daily data file, where the "dd" parameter is a number that represents a day of the month.
/ proc, which contains various files with system statistics.
4. Example code
Sar-u 2 5
CPU utilization is reported every 2 seconds. 5 lines are displayed.
Sar-I 14-o int14.file 2 10
Statistics for IRQ 14 are reported every 2 seconds. Displays 10 lines. The data is stored in a file called int14.file.
Sar-r-n DEV-f / var/log/sa/sa16
Displays memory and network statistics stored in the daily data file "sa16"
Sar-A
Displays all statistics saved in the current daily data file.
5. Examples
1) display cpu usage
[root@localhost ntop-4.0.1] # sar-P ALL / / shows all cpu usage
Linux 2.6.32-431.el6.i686 (localhost.localdomain) October 10, 2018 _ i6861CPU)
09:00:01 CPU user nice system iowait steal idle
09:10:01 all 0.16 0.00 0.07 0.02 0.00 99.75
09:10:01 0 0.16 0.00 0.07 0.02 0.00 99.75
09:10:01 CPU user nice system iowait steal idle
09:20:01 all 0.13 0.00 0.09 0.03 0.00 99.75
09:20:01 0 0.13 0.00
...
2) display network usage
[root@localhost ntop-4.0.1] # sar-n SOCK-s 15:00:00-e 16:20:00 / / displays the socket usage status in the network, and sets the start and end time of the display
Linux 2.6.32-431.el6.i686 (localhost.localdomain) August 10, 2018 _ i6861CPU)
15:00:01 totsck tcpsck udpsck rawsck ip-frag tcp-tw
15:10:01 707 5 6 0 0 0
15:20:01 723 5 6 0 0 0
Average time: 715 560 000
15:24:21 LINUX RESTART
15:30:01 totsck tcpsck udpsck rawsck ip-frag tcp-tw
15:40:01 702 5 6 0 0 0
15:50:01 698 5 6 0 0 0
16:00:01 698 5 6 00 0
16:10:01 717 5 6 0 0 0
Average time: 704 5 6 000
15:00:01 totsck tcpsck udpsck rawsck ip-frag tcp-tw
15:10:01 797 19 11 0 0 0
15:20:01 801 19 11 0 0 0
15:30:01 797 19 11 0 0 0
15:40:01 775 16 11 0 0 0
15:50:02 775 16 11 0 0 0
16:00:01 775 16 11 00 0
16:10:01 775 16 11 0 0 0
Average time: 785 17 11 000
[root@localhost ntop-4.0.1] #
At this point, I believe you have a deeper understanding of "the use of the Linux basic command sar". You might as well do it in practice. Here is the website, more related content can enter the relevant channels to inquire, follow us, continue to learn!
Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.
Views: 0
*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.
Continue with the installation of the previous hadoop.First, install zookooper1. Decompress zookoope
"Every 5-10 years, there's a rare product, a really special, very unusual product that's the most un
© 2024 shulou.com SLNews company. All rights reserved.