Monitoring tools --nmon
nmon is a linux operating system on a wide range of monitoring and analysis tools are there, the information is recorded nmon more comprehensive, they can capture the usage of system resources in real time during system operation, and can output to a file and then generate a data file with the graphical results nmon_analyzer tool.
Enter the following command into the server to download nmon:
wget http://sourceforge.net/projects/nmon/files/nmon_linux_14i.tar.gz
unpack:
tar zxvf nmon_linux_14i.tar.gz extract to the current directory
Enter the command to view system version, and then select the server system associated with the package name change:
CAT / proc / Version
Change the name:
mv nmon_x86_64_debian7 nmon
copied to the bin directory:
cp nmon / usr / bin
nmon usage:
nmon -f This is a mandatory parameter, and must come first, meaning that the output file; with this argument, nmon output file name is the default name: hostname_date_time.nmon, is the host name Date Time .nmon
-F <filename> this is the same argument and -f, except that users can define their own file names;
-s data collection frequency, the frequency of which is stored data;
-c data collection frequency
-t most resource-consuming process output data
-h View help
enter the command:
the nmon -f -F demo.nmon -s -t 1 -c 10
-f output
-F file to the output file to demo.nmon
-s frequency per second at
-c statistics 10
-t output most the process of consumption of resources
View demo.nmon file:
CAT demo.nmon
nmon_analyzer Tools
nmon_analyzer role is to analyze the results of nmon data collection, nmon_annlyzer need the help of Excel macros to open and check the results.
First download nmon_annlyzer, Download:
https://www.ibm.com/developerworks/community/wikis/home?lang=en#!/wiki/Power+Systems/page/nmon_analyser
find Download and Links, click download, download the local computer:
After downloading unzip is:
The demo.nmon in the server downloaded to the local:
Open: nmon analyser v60.xlsm
Generating demo.nmon.xlsx, open follows:
The document sheet page explains:
SYS_SUMM: system summary page, contains the CPU occupancy rate change information, the change of disk IO and so on;
AAA: some information about the operating system and nmon itself
CPU_ALL: All CPU overview, displaying all CPU average occupancy where
CPU_SUMM: occupancy of each CPU within the execution time
DISKBUSY: hdisk devices each disk group is on average
DISKREAD: average read each disk group
DISKBSIZE: leveling each disk group
DISKWRITE: each disk the average write the set of the
DISKXFER: I / O operations per second per disk group
MEM: memory-related primary information, use, free memory size
Regular tasks
linux system is controlled by the system cron service, including a lot of planning work on linux system, users themselves can set scheduled tasks, linux system provides a user-controlled command scheduled task. This command is crontab command.
crontab start :
Because debian system I use, with /etc/init.d/cron start to start the service
to view /etc/init.d/cron status status
/etc/init.d/cron stop / restart services Stop / Restart service
crontab service privileges :
crontab rights management and file storage cron.allow cron.deny file in. If you can not create in the etc directory.
Enter etc directory, vi cron.allow linux user name can be written in the file:
Creating Success:
cron.deny files are created the same way and cron.allow.
cron.allow file is stored which users are allowed to use crontab.
cron.deny file storage which users are not allowed to use crontab.
crontab usage scenarios Description :
When two files are not present, then only allow the root user to use crontab.
When cron.allow file exists, but cron.deny file does not exist, then the user is only allowed cron.allow file using crontab.
When cron.deny file exists, but cron.allow file does not exist, so long as it is not listed in the cron.deny file users can use crontab.
If both files are present, but a user has in two files, then to cron.allow file is correct, as long as there is cron.allow file that users can use crontab.
crontab using
crontab -e command in the Edit Page input
The basic format: minute hour day month week command
counterparts: moon and peripheral sharing command
Time Unit Description :
The first column represents 00 to 59 minutes per min * or * / 1 indicates
the second column shows 00 to 230 hours indicates 0:00
third column indicates 01 to 31
in the fourth column represents a 01 to 12 month
of five represents the identification number of the week from 0 to 6 (0 for Sunday)
the sixth column shows the command to run
Symbol Description :
- All values representative of the range
/ mean representing each
- Representative from a digital to a certain number
, separated by several different numbers
First check cron service is started:
/etc/init.d/cron Status
Edit a command:
the crontab -e i Press ESC and enter the command to switch
input:
20 is 14 ~ 4. 6 2 mkdir / QZX
Representative QZX create a directory on June 4, 2:20 pm on Tuesday.
See the directory in the root directory has been created:
Enter the command again, remove the directory
27 14 * * * rm -rf ~ / qzx
behalf delete qzx directory in two in the afternoon 27 minutes
Again View directory has been deleted:
Example
Example 1: a command execution every 1 minute
Command: * * * * * command
Example 2: 3 and every hour in the first 15 minutes of
Command: 3,15 * * * * command
Example 3: 3 and performed in the first 15 minutes of 8:00 to 11:00
Command: 3,15 8-11 * * * command
Example 4: 3 and performs the first 15 minutes of every day 8:00 to 11:00
命令:3,15 8-11 */2 * * command
实例5:每个星期一的上午8点到11点的第3和第15分钟执行
命令:3,15 8-11 * * 1 command
实例6:每晚的21:30重启smb
命令:30 21 * * * /etc/init.d/smb restart
实例7:每月1、10、22日的4 : 45重启smb
命令:45 4 1,10,22 * * /etc/init.d/smb restart
实例8:每周六、周日的1 : 10重启smb
命令:10 1 * * 6,0 /etc/init.d/smb restart
实例9:每天18 : 00至23 : 00之间每隔30分钟重启smb
命令:0,30 18-23 * * * /etc/init.d/smb restart
实例10:每星期六的晚上11 : 00 pm重启smb
命令:0 23 * * 6 /etc/init.d/smb restart
实例11:每一小时重启smb
命令:* */1 * * * /etc/init.d/smb restart
实例12:晚上11点到早上7点之间,每隔一小时重启smb
命令:* 23-7/1 * * * /etc/init.d/smb restart
实例13:每月的4号与每周一到周三的11点重启smb
命令:0 11 4 * mon-wed /etc/init.d/smb restart
实例14:一月一号的4点重启smb
命令:0 4 1 jan * /etc/init.d/smb restart
实例15:每小时执行/etc/cron.hourly目录内的脚本
命令:01 * * * * root run-parts /etc/cron.hourly
说明:
run-parts这个参数了,如果去掉这个参数的话,后面就可以写要运行的某个脚本名,而不是目录名了
数据驱动
The data driver definitions:
test data is read from a data file, a test method of driving test, the data driver can be understood as a more advanced parameterized. Separation of test data and test code, you can control the testing process data, such as access to information about sex, sex for men walk a branch process, sex for women to go to another branch of the process.
Data-driven test code amount can be reduced, reducing script development and maintenance costs, and ease of maintenance with the modified embodiment, only the test data is not changed over to change the test code to complete the test data is different.
Data-driven usage scenarios:
according to the business scene shunt in complex business processes, creating qualified concurrency scenarios.
Create a scene using data-driven concept jemeter the
first step in configuring jemeter fetch data from the database
into the database to view the data, taking sex data fields in the user table:
Entering jemeter, adding configure JDBC Connection Configuration element:
Add JDBC Request in the sampler:
Adding Debug Sampler in the sampler, the results are easy to see:
Results of the:
Since there are 5 data, the sex _ # = 5, each of the results to count the number used, such sex_1 = 1
NOTE: If you want to get more information from a database table, set the name of the database in the variable name for created pool JDBC Connection Configuration, the name of the pool set in the JDBC Request for name of the database, sql statement is written with the database name The database table name to query the database information, as shown:
Step arranged along different branches of the controller if the flow is determined based on the data
added if the controller if the logic controller
Add sampler Sampler in BeanShell:
System.out.println ( "Sex is a woman");
Add another controller if if if equal to 0 to go this branch:
The results seen in jemeter execution log:
The third step loop setting parameters determined for all data
open configuration element, counter Found:
Open the function assistant:
find __V, enter
sex_${count}
Click Generate, copy
${__V(sex_${count})}
Replace if controller, two controllers need to be replaced if:
Adding the cyclic controller logic controller:
Maximum number of loops is $ {sex_ #} is to take the number of pieces of data from the database
The counter, if the controller into the loop controller below, click on the execution to see the results: