#1、启用停用VIP

sudo /etc/ha.d/resource.d/IPaddr 10.10.10.10 start
sudo /etc/ha.d/resource.d/IPaddr 10.10.10.10 stop

 #2、查看MySQL QPS

mysqladmin --login-path=local -r -i  -c  ext |\
awk -F"|" \
"BEGIN{ count=0; }"\
'{ if($2 ~ /Variable_name/ && ((++count)%20 == 1)){\
print "----------|---------|--- MySQL Command Status --|----- Innodb row operation ----|-- Buffer Pool Read --|-- slowqueries --";\
print "---Time---|---QPS---|select insert update delete| read inserted updated deleted| logical physical| slowqueries";\
}\
else if ($ ~ /Queries/){queries=$;}\
else if ($ ~ /Com_select /){com_select=$;}\
else if ($ ~ /Com_insert /){com_insert=$;}\
else if ($ ~ /Com_update /){com_update=$;}\
else if ($ ~ /Com_delete /){com_delete=$;}\
else if ($ ~ /Innodb_rows_read/){innodb_rows_read=$;}\
else if ($ ~ /Innodb_rows_deleted/){innodb_rows_deleted=$;}\
else if ($ ~ /Innodb_rows_inserted/){innodb_rows_inserted=$;}\
else if ($ ~ /Innodb_rows_updated/){innodb_rows_updated=$;}\
else if ($ ~ /Innodb_buffer_pool_read_requests/){innodb_lor=$;}\
else if ($ ~ /Innodb_buffer_pool_reads/){innodb_phr=$;}\
else if($~/Slow_queries/){slow_queries=$;}\
else if ($ ~ /Uptime / && count >= ){\
printf(" %s |%9d",strftime("%H:%M:%S"),queries);\
printf("|%6d %6d %6d %6d",com_select,com_insert,com_update,com_delete);\
printf("|%6d %8d %7d %7d",innodb_rows_read,innodb_rows_inserted,innodb_rows_updated,innodb_rows_deleted);\
printf("|%10d %11d",innodb_lor,innodb_phr);\
printf("|%11d\n",slow_queries);\
}}'

#3、进程号占用的swap

awk '/^Swap:/ {SWAP+=$2}END{print SWAP" KB"}' /proc/$(pid)/smaps

#4、查看swap使用的进程和内存

for i in $( cd /proc;ls |grep "^[0-9]"|awk ' $0 >100') ;do awk '/Swap:/{a=a+$2}END{print '"$i"',a/1024"M"}' /proc/$i/smaps 2>/dev/null ; done | sort -k2nr | head -10

【原创】Linux常用脚本的更多相关文章

  1. Linux 常用脚本

    Linux 常用脚本   修改表列属性   sql可任意修改,若数据库正好在执行机器上,可去掉ip地址 echo 为输出   #!/bin/shfor((i=0;i<256;i++));do   ...

  2. Linux 常用脚本命令

    Linux 常用(脚本)命令 1. 统计目录下文件个数 ll |grep "^-"|wc -1 解释 grep "^-"表示抓取以-开头的行(其他忽略)

  3. linux常用脚本

    转载于http://justcoding.iteye.com/blog/1943504 我们在运维中,尤其是linux运维,都知道脚本的重要性,脚本会让我们的 运维事半功倍,所以学会写脚本是我们每个l ...

  4. Linux常用脚本命令总结

    基本操作 通用操作 1. export 显示所有的环境变量,也可以获取到某个变量的详细信息: export # 显示所有 echo $SHELL # 只显示SHELL 2. whereis 使用系统自 ...

  5. 【汇总】Linux常用脚本shell

    [crontab] #每天6:00 执行a.sh00 6 * * * /bin/sh /home/work/rxShell/a.sh #每天3:20 执行a1.sh20 3 * * * /bin/sh ...

  6. Linux常用Shell脚本珍藏【转载】

    我们在运维中,尤其是linux运维,都知道脚本的重要性,脚本会让我们的 运维事半功倍,所以学会写脚本是我们每个linux运维必须学会的一门功课,这里收藏linux运维常用的脚本.如何学好脚本,最关键的 ...

  7. linux——常用命令与脚本

    linux常用命令 --文件管理pwd --查看当前目录cd --切换当前目录ls --列出当前目录下的所有文件touch --创建文件mkdir --建立目录rmdir --删除空目录rm --删除 ...

  8. 【不积跬步,无以致千里】五个常用的Linux监控脚本代码

    为大家提供五个常用Linux监控脚本(查看主机网卡流量.系统状况监控.监控主机的磁盘空间,当使用空间超过90%就通过发mail来发警告.监控CPU和内存的使用情况.全方位监控主机),有需要的朋友不妨看 ...

  9. linux常用命令【原创】

    查看文件内容-while: cat 1.txt|while read line;do echo $line;done while read line; do echo $line; done < ...

随机推荐

  1. AspNetPager控件的最基本用法

    AspNetPager控件是一个基于.net的第三方免费开源控件,具有开发高效.使用方便.功能完整等优点.它弥补了GridView内置分页以及PageDatasource类辅助分页的不足,将分页数据逻 ...

  2. ArcGis数据分类(ClassBreaksDefinition)

    文章转载自:Arcgis数据分类那些事儿 数据分类.地图分级(Classification)通常用于Choropleth Map(面量图)的制作中,是专题制图中最初,也是最基本的一个步骤.没有进行过分 ...

  3. mysql修改表操作

    一: 修改表信息 1.修改表名 alter table test_a rename to sys_app; 2.修改表注释 alter table sys_application comment '系 ...

  4. 【HASPDOG】hasp_update参数f和i区别

    [root@BICServer-TX shared]# ./hasp_update This is a simple demo program for the Sentinel Update and ...

  5. Vue起步

    Vue起步 Vue.js是什么 Vue (读音 /vjuː/,类似于 view) 是一套用于构建用户界面的渐进式javascript框架.与其它大型框架不同的是,Vue 被设计为可以自底向上逐层应用. ...

  6. http请求与传参

    这并不算是文章,暂时只做粗略地记录,以免忘记,因此会显得杂乱无章,随便抓了几个包和对postman截图,日后有空再完善 1.get方式 只有一种方式,那就是在url后面跟参数 2.post方式 1)表 ...

  7. No.5 selenium学习之路之多窗口句柄

    多窗口相关操作 获取当前句柄 c_handle = driver.current_window_handle 获取所有句柄 all_handle = driver.window_handles 切换到 ...

  8. AdvStringGrid 复选框、goRowSelect

    var I: Integer; begin do begin AdvStringGrid1.AddCheckBox(, I, True, True); AdvStringGrid1.Cells[,I] ...

  9. Extjs 代码拾穗

    1.tree grid 添加一行 var rootNode = store.getRootNode(); var newRecord = Ext.create('MatrixDlv',{"s ...

  10. LeetCode517. Super Washing Machines

    You have n super washing machines on a line. Initially, each washing machine has some dresses or is ...