I. SNMP
yum install net-snmp net-snmp-utils -yservice snmpd start
Netstat-UNLP # view the SNMP port number: 161 snmpwalk-V 2C-C public localhost # view local SNMP information ls/usr/share/snmp/mibs/# view MIB library files less SNMPv2-MIB.txt # view standard MIB library files CAT/etc /snmp/snmpd. conf # view the SNMP configuration file snmpget-V 2C-C public localhost HOST-RESOURCES-MIB: hrsystemuptime.0 # view the local SNMP information snmpget-V 2C-C public localhost HOST-RESOURCES-MIB :: hrsystemuptime.1less TCP-MIB.txt # view the TCP library file VI/etc/snmp/snmpd. conf # Add a TCP library file in the configuration file to define service snmpd restartsnmpwalk-V 2C-C public localhost TCP # You can view TCP-related information. snmpwalk-V 2C-C public localhost TCP | grep established | WC-L # view established connections VI/etc/snmp/snmpd. conf # change the password from public to mypublicvi/etc/snmp/snmpd. conf # restart the service snmpwalk-V 2C-C public 192.168.2.52 TCP # The original connection is no longer available snmpwalk-V 2C-C mypublic 192.168.2.52 TCP # Use the changed password to establish a connection snmpnetstat-V 2c-C mypublic-ca-cp tcp localhost # Use snmpnetstatsnmpnetstat-V 2C-C mypublic-can-cp tcp localhost
chkconfig snmpd onchkconfig --list|grep snmpd
Ii. rrdtool:
wget http://packages.express.org/rrdtool/rrdtool-1.4.7-1.slc6.wrl.x86_64.rpmwget http://packages.express.org/rrdtool/rrdtool-devel-1.4.7-1.slc6.wrl.x86_64.rpmwget http://packages.express.org/rrdtool/rrdtool-perl-1.4.7-1.slc6.wrl.x86_64.rpmyum -y --nogpgcheck install rrdtool-1.4.7-1.slc6.wrl.x86_64.rpm rrdtool-perl-1.4.7-1.slc6.wrl.x86_64.rpm
CD/tmp/rrdtool create test. RRD -- step 5 DS: testds: gauge: 8: 0: u rra: average: 0.5: 1: 17280 RRA: average: 0.5: 10: 3456 RRA: average: 0.5: 100: 1210ll-h # view the created RRD file attributes rrdtool info test. RRD # view RRD file content rrdtool update test. rrd n: $ random # the random number rrdtool fetch test is generated continuously from the RRD file. RRD average # view the matching item VI Genval. sh # generate a batch processing script file and continuously generate a random number from RRD [[email protected] TMP] # Cat Genval. sh ##! /Bin/bash # While true; do rrdtool update test. rrd n: $ random sleep 5 donebash-x Genval. sh # compile and execute rrdtool fetch-R 5 test in debug mode. RRD average # generate data rrdtool fetch-R 10 test every 5s. RRD average # generate data rrdtool fetch-r 50 test every 10 s. RRD average # generate data every 50 s rrdtool graph a.png -- step 5-s 1405335030 Def: vartest = test. RRD: testds: Average line1: vartest # ff0000: "testline" # Draw a chart every 5s rrdtool graph a.png -- step 50-s 1405335030 Def: vartest = test. RRD: testds: Average line1: vartest # ff0000: "testline" # plot the image every 50 s rrdtool graph a.png-s 1405335030 Def: vartest = test. RRD: testds: average: Step = 5 Def: vartest2 = test. RRD: testds: average: Step = 50 line1: vartest # ff0000: "testline" line2: vartest2 #00ff00: "testline2" # simultaneously draw 5s and 50s Diagrams
Yum install mysql-server-yservice mysqld startmysqladmin-u Root Password 'zhoufwind' [[email protected] ~] # Mysql-u root-pmysql> show global status like 'com _ select '; + --------------- + ------- + | variable_name | value | + --------------- + ------- + | com_select | 3 | + --------------- + ------- + 1 row in SET (0.00 Sec) rrdtool create MySQL. RRD -- step 3 ds: myselect: Counter: 5: 0: u rra: average: 0.5: 1: 28800 RRA: average: 0.5: 10: 2880 RRA: Max: 0.5: 10: 2880 RRA: Last: 0.5: 10: 2880 # create an RRD file [[email protected] TMP] # mysql-uroot-P Zhoufwind-e "show global status like 'com _ select'" + --------------- + ------- + | variable_name | value | + --------------- + ------- + | com_select | 4 | + --------------- + ------- + [[email protected] TMP] # MySQL -- batch-uroot-pzhoufwind-e "show global status like 'com _ select'" variable_name valuecom_select 5 [[email protected] TMP] # MySQL -- batch-uroot-pzhoufwind-e "show global status like 'com _ select'" | Awk '/com_select/{pri} [[email protected] TMP] # MySQL -- batch-uroot-pzhoufwind-e "show global status like 'com _ select'" | awk '/ com_select/{print $2} '6 [[email protected] TMP] # MySQL -- batch-uroot-pzhoufwind-e "show global status like 'com _ select'" | awk' /com_select/{print $2} '7 # simplified query result [[email protected] TMP] # vi getselect. sh # create a script to continuously monitor the number of queries "getselect. sh "[new] 6l, 148c written [[email protected] TMP] # Cat getselect. Sh #! /Bin/bash # While true; do select = 'mysql -- batch-uroot-pzhoufwind-e "show global status like 'com _ select'" | awk '/com_select/{print $2} ''rrdtool update MySQL. rrd n: $ select sleep 3 donebash-x getselect. sh # compile and execute VI insert. sh # create scripts to constantly insert and query databases "insert. sh "[new] 6l, Objective C written [[email protected] TMP] # Cat insert. sh #! /Bin/bash # For I in {1 .. 200000}; do mysql-uroot-pzhoufwind-e "insert into testdb. tb1 (name) values ('stu $ I ') "mysql-uroot-pzhoufwind-e" select * From testdb. tb1 "&>/dev/nulldone [[email protected] TMP] # bash-x insert. sh + for I in '{1 .. 200000} '+ MySQL-uroot-pzhoufwind-e' insert into testdb. tb1 (name) values ('\ ''stu1' \ '')' + MySQL-uroot-pzhoufwind-e' select * From testdb. tb1 '+ for I in' {1 .. 200000} '+ MySQL-uroot-pzhoufwind-e' insert into testdb. tb1 (name) values ('\ ''stu2' \ '')' + MySQL-uroot-pzhoufwind-e' select * From testdb. tb1 '+ for I in' {1 .. 200000 }'... rrdtool fetch-R 5 MySQL. RRD average # generate the average data rrdtool fetch-R 30 MySQL every 5s. RRD average # generate average data every 30 s rrdtool fetch-R 30 MySQL. RRD Max # generate the maximum data every 30 s rrdtool fetch-R 30 MySQL. RRD last # generate the last execution data every 30 s rrdtool graph mysql.png-s 1405339620-T "MySQL select"-V "selects/3" Def: select3 = MySQL. RRD: myselect: average: Step = 3 line1: select3 # ff0000: "select" # plot the number of queries per 3 seconds. rrdtool graph mysql.png-s 1405339620-T "MySQL select"-V "selects/30" Def: select30 = MySQL. RRD: myselect: average: Step = 30 Def: max30 = MySQL. RRD: myselect: Max: Step = 30 line1: select30 # ff0000: "select" uplint: max30: Max: "Maximum \: % 6.2lf "# Draw the average/maximum value graph for every 30 seconds rrdtool graph mysql.png-s 1405339620-T" MySQL select "-V" selects/30 "Def: select30 = MySQL. RRD: myselect: average: Step = 30 Def: max30 = MySQL. RRD: myselect: Max: Step = 30 Def: last30 = MySQL. RRD: myselect: Last: Step = 30 line1: select30 # ff0000: "select" uplint: max30: Max: "Maximum \: % 6.2lf" uplint: last30: last: "Current \: % 10.2lf" # Draw the average/Maximum/current value graph of every 30 seconds
650) This. width = 650; "src =" http://s3.51cto.com/wyfs02/M01/3D/5E/wKiom1PEhlOCfDP1AADp0HDIcJc651.jpg "style =" float: none; "Title =" a_2.png "alt =" wkiom1pehlocfdp1aadp0hdicjc651.jpg "/>
650) This. width = 650; "src =" http://s3.51cto.com/wyfs02/M00/3D/5D/wKioL1PEhiSTfePVAAEdFAkDeyE325.jpg "style =" float: none; "Title =" a_3.png "alt =" wkiol1pehistfepvaaedfakdeye325.jpg "/>
650) This. width = 650; "src =" http://s3.51cto.com/wyfs02/M02/3D/5E/wKiom1PEhlTRFjv5AADfRAbe--k786.jpg "style =" float: none; "Title =" mysql_3s.png "alt =" wKiom1PEhlTRFjv5AADfRAbe--k786.jpg "/>
650) This. width = 650; "src =" http://s3.51cto.com/wyfs02/M02/3D/5E/wKiom1PEhlSA4QXaAADeTNclrqQ309.jpg "style =" float: none; "Title =" mysql_30s.png "alt =" wkiom1pehlsa4qxaaadetnclrqq309.jpg "/>
650) This. width = 650; "src =" http://s3.51cto.com/wyfs02/M01/3D/5D/wKioL1PEhiWCr-y2AADpntIGtcs221.jpg "style =" float: none; "Title =" mysql_30s_with-max.png "alt =" wKioL1PEhiWCr-y2AADpntIGtcs221.jpg "/>
650) This. width = 650; "src =" http://s3.51cto.com/wyfs02/M01/3D/5D/wKioL1PEhiXT58yDAAD4yaqC6P8209.jpg "style =" float: none; "Title =" mysql_30s_with-max-last-2.png "alt =" wkiol1pehixt58ydaad4yaqc6p8209.jpg "/>
Iii. References:
This article is from the "little devil's territory" blog, please be sure to keep this source http://zhoufwind.blog.51cto.com/1029821/1438217