mysqlMem 监控:
#!/bin/bash
Pid=`/bin/ps -ef|grep mysqld|grep -Ev "grep|safe"|awk '{print $2}'`
vMem=`/usr/bin/top -b -n 1 -p $Pid |grep mysql |awk '{print $5}'|awk -F"g" '{print $1}'`
rMem=`/usr/bin/top -b -n 1 -p $Pid |grep mysql |awk '{print $6}'|awk -F"g" '{print $1}'`
if [ $1 == "vMem" ];then
  echo $vMem
elif [ $1 == "rMem" ];then
  echo $rMem
fi

mysqlCpu监控:
#!/bin/bash
Pid=`/bin/ps -ef|grep mysqld|grep -Ev "grep|safe"|awk '{print $2}'`
#vMem=`/usr/bin/top -b -n 1 -p $Pid |grep mysql |awk '{print $5}'|awk -F"g" '{print $1}'`
Cpu=`/usr/bin/top -b -n 1 -p $Pid |grep mysql |awk '{print $9}'|awk -F"g" '{print $1}'`
if [ $1 == "Cpu" ];then
  echo $Cpu
elif [ $1 == "rMem" ];then
  echo $rMem
fi

mysql cpu和内存监控的更多相关文章

  1. python代码优化-----cpu和内存监控

    1.memory_profiler可以监控代码的内存消耗及增长量,以下面的代码为例. 发现在for循环里增加了0.3MB,这个工具可以帮助我们定位内存泄露的问题. 2.profile与cProfile ...

  2. 压测过程中,CPU和内存占用率很高,案例简单分析

    Q:  最近公司测试一个接口,数据库采用Mongo    并发策略:并发400个用户,每3秒加载5个用户,持续运行30分钟    数据量:8000条左右 压测结果发现:    TPS始终在5左右   ...

  3. 监控操作系统的CPU、内存、磁盘

    Linux 四大件:CPU.内存.磁盘.网络 CPU 就像人的大脑,主要负责相关事情的判断以及实际处理的机制. CPU的性能主要体现在其运行程序的速度上.影响运行速度的性能指标包括CPU的工作频率.C ...

  4. 为Zabbix配置Nova服务、Keystone和Placement进程CPU和内存usage监控

    目前已经完成了RabbitMQ和MySQL的监控项配置,还差对nova-api.nova-conductor.nova-scheduler和keystone进程CPU和内存 usage的监控,类似的轮 ...

  5. 监控CPU和内存的使用

    监控CPU和内存的使用: #!/bin/bash #script to capture system statistics outfile=/home/rainbow/test/file.csv da ...

  6. 系统内存和CPU管理、监控

    本博文的主要内容有 .系统内存管理.监控:vmstat和free -mt .系统CPU管理.监控:sar -u.mpstat.uptime linux系统内存和CPU是在系统运行的过程中不断消耗的资源 ...

  7. linux中监控CPU、内存和磁盘状态的shell脚本。(centos7)

    这篇博客中所写的脚本,在实际工作中并没有什么卵用,工作中并不会用到这种脚本去监控.不过自己写一遍,可以让初学者对CPU.内存.磁盘等一些基础知识和基础命令更加了解. 1.利用vmstat工具监控CPU ...

  8. 转:JMeter监控内存及CPU ——plugin插件监控被测系统资源方法

    JMeter监控内存及CPU ——plugin插件监控被测系统资源方法 jmeter中也可以监控服务器的CPU和内存使用情况,但是需要安装一些插件还需要在被监测服务器上开启服务. 1.需要的插件准备 ...

  9. shell脚本监控系统负载、CPU和内存使用情况

    hostname >>/home/vmuser/xunjian/xj.logdf -lh >>/home/vmuser/xunjian/xj.logtop -b -n 1 | ...

随机推荐

  1. OC中的extern,static,const

    const的作用: const仅仅用来修饰右边的变量(基本数据变量p,指针变量*p). 被const修饰的变量是只读的. static的作用: 修饰局部变量: 1.延长局部变量的生命周期,程序结束才会 ...

  2. PerfMon.exe通过命令管理计数器

    通过PerfMon命令可以管理计数器,添加删除调整等等. 例1:Logman:在本地和远程系统上,管理和调度性能计数器和事件跟踪日志. master..xp_cmdshell 'logman quer ...

  3. ASP.NET AJAX调用 WebService

    同事的代码,帮忙修改的,为了实现页面跳转回来后,状态的保持,Service 使用了Session. 主要的JS $.ajax({ url: "/ws/StaffInfo.asmx/Note& ...

  4. 《CMake实践》笔记一:PROJECT/MESSAGE/ADD_EXECUTABLE

    <CMake实践>笔记一:PROJECT/MESSAGE/ADD_EXECUTABLE <CMake实践>笔记二:INSTALL/CMAKE_INSTALL_PREFIX &l ...

  5. Linux cp (复制)命令简介

    \cp  -rf  source1  source2   source3   ....   directory cp (复制档案或目录) [root@linux ~]# cp [-adfilprsu] ...

  6. UItableview 添加 uisearchController

    @property (nonatomic, strong) UISearchController* searchController; self.searchController = [[UISear ...

  7. MyBatis学习(四)MyBatis和Spring整合

    MyBatis和Spring整合 思路 1.让spring管理SqlSessionFactory 2.让spring管理mapper对象和dao. 使用spring和mybatis整合开发mapper ...

  8. 【leetcode】Evaluate Reverse Polish Notation

    Evaluate Reverse Polish Notation 题目描述: Evaluate the value of an arithmetic expression in Reverse Pol ...

  9. HDU 5769 Substring 后缀数组

    Substring Problem Description ?? is practicing his program skill, and now he is given a string, he h ...

  10. JS截字符串处理数字,汉字,英文问题

    <script> function suolve( str,sub_length ){ var temp1 = str.replace(/[^\x00-\xff]/g,"**&q ...