In addition to Weibo, there is also WeChat
Please pay attention
WeChat public account
Shulou
2025-02-24 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Servers >
Share
Shulou(Shulou.com)06/01 Report--
How to understand System Activity Report, I believe that many inexperienced people are at a loss about it. Therefore, this paper summarizes the causes and solutions of the problem. Through this article, I hope you can solve this problem.
Common format of the sar command line:
Sar [options] [- A] [- o file] t [n]
On the command line, the two parameters n and t are combined to define the sampling interval and times. T is the sampling interval and is a necessary parameter. N is the sampling number and is optional. The default value is 1m file, which means to store the command results in a file in binary format.
File is not a keyword here, it's a file name. Options is a command line option, and there are many options for the sar command. Only common options are listed below:
A: the sum of all the reports.
-u:CPU utilization
-v: process, I node, file, and lock table status.
-d: hard disk usage report.
-r: no memory pages and hard disk blocks are used.
-g: the situation of serial port IWeiO.
-b: buffer usage.
-a: the reading and writing of documents.
-c: system call situation.
-R: the activity of the process.
-y: terminal equipment activity.
-w: system exchange activity.
-n: record network usage
Default monitoring: sar 5 5 / / CPU and IOWAIT statistical status
(1) sar-b 55 / / IO transfer rate
(2) sar-B 55 / page exchange rate
(3) rate of sar-c 5 5 / / process creation
(4) active information of sar-d 55 / block devices
(5) sar-n DEV 55 / / status information of network devices
(6) the use of sar-n SOCK 55 / / SOCK
(7) sar-n ALL 55 / / all network status information
(8) sar-P ALL 55 / / usage status information and IOWAIT statistical status of each CPU
(9) length of sar-Q 5 5 / / queue (number of processes waiting to run) and load status
(10) sar-r 55 / / memory and swap space usage
(11) sar-R 5 5 / / memory statistics (allocation and release of memory pages, memory pages used by the system as BUFFER per second, memory pages cache per second)
(12) usage and IOWAIT information of sar-u 55 / / CPU (same as default monitoring)
(13) status information of sar-v 55 / / inode, file and other kernel tablesd
(14) sar-w 55 / / number of context exchanges per second
(15) Statistics exchanged by sar-W 55 / / SWAP (si so with the same monitoring status as iostat)
(16) sar-x 2906 55 / / displays statistical information for the specified process (2906), including errors caused by the process, user-level and system-level user CPU usage, and which CPU is running on
(17) activity status of sar-y 55 / / TTY devices
(18) output to file (- o) and read record information (- f)
CPU CPU identifier; "all" represents all CPU
The percentage of CPU used by% user user processes. Oracle processes fall into this category.
Percentage of CPU utilization performed by% nice under nice priority
% CPU percentage of system executing system processes
% CPU percentage of iowait waiting for iUnip O operation
% idle percentage of CPU idle waiting for work
Sar relies on sysstat package
[root@testdb ~] # rpm-qa | grep sysstat
Sysstat-7.0.2-11.el5
If you don't have an installation, you can install it using yum install sysstat.
Start sysstat
/ etc/init.d/sysstat start
Set sysstat self-startup
Checkfig sysstat on
1. Hand-written scripts use sar commands to monitor the system
1.1 it is troublesome to extract yesterday's sar files.
1.2 the sar information of the day is extracted to the file at 23:59:59 every day, and the oracle data is accessed by external tables.
1.21 define script
#! / bin/bash
Sar | awk'/: 01 / {print $1, 2 tmp/sarlog.txt, 3, 4, 5, 6, 7, 8, 9}'> / tmp/sarlog.txt
Above is the script code, defined in crontab.
12:10:01 AM all 0.05 0.00 0.02 0.08 0.00 99.86
Take the above line as an example, it all runs at: 01, so I get each line according to this condition.
1.22 create an external table
SQL > create or replace directory sardump as'/ tmp'
Directory created.
CREATE TABLE EXTER_SAR
(
Vdate VARCHAR (12)
Vapm VARCHAR (12)
Vcpu VARCHAR (12)
Vuser VARCHAR (12)
Vnice VARCHAR (12)
Vsystem VARCHAR (12)
Viowait VARCHAR (12)
Vsteal VARCHAR (12)
Vidle VARCHAR (12)
) ORGANIZATION EXTERNAL
(
Type oracle_loader
Default directory sardump
Access parameters
(
Records delimited by newline
Fields terminated by''
)
Location ('sarlog.txt')
);
1.23 perform a verification
SQL > select * from EXTER_SAR
VDATE VAPM VCPU VUSER VNICE VSYSTEM VIOWAIT VSTEAL VIDLE
12:00:01 AM CPU user nice system iowait steal idle
12:10:01 AM all 0.05 0.00 0.02 0.08 0.00 99.86
Probably achieved the goal.
two。 Automatic timing monitoring of the system
2.1 modify run time
The default is once every 10 minutes.
[root@testdb ~] # cat / etc/cron.d/sysstat
# run system activity accounting tool every 10 minutes
* / 10 * root / usr/lib64/sa/sa1 1 1
# generate a daily summary of process accounting at 23:53
53 23 * root / usr/lib64/sa/sa2-A
* / 10 can be modified.
2.2 modify the save time
Sar system timing monitoring is saved for 7 days by default, and the save path is / var/log/sa.
[root@testdb ~] # cat / usr/lib64/sa/sa2
#! / bin/sh
# / usr/lib64/sa/sa2.sh
# (C) 1999-2006 Sebastien Godard (sysstat wanadoo.fr)
#
# Changes:
#-2004-01-22 Nils Philippsen
# make history configurable
#
HISTORY=7
[- r / etc/sysconfig/sysstat] & &. / etc/sysconfig/sysstat
[${HISTORY}-gt 25] & & HISTORY=25
S_TIME_FORMAT=ISO; export S_TIME_FORMAT
Umask 0022
DATE= `date +% d`
RPT=/var/log/sa/sar$ {DATE}
ENDIR=/usr/bin
DFILE=/var/log/sa/sa$ {DATE}
[- f "$DFILE"] | | exit 0
Cd ${ENDIR}
${ENDIR} / sar $*-f ${DFILE} > ${RPT}
Find / var/log/sa\ (- name 'sar??'-o-name' sa??'\)-mtime + "${HISTORY}"-exec rm-f {}\
HISTORY=7 can be modified
After reading the above, have you mastered how to understand System Activity Report? If you want to learn more skills or want to know more about it, you are welcome to follow the industry information channel, thank you for reading!
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.