zoukankan      html  css  js  c++  java
  • mysql cpu和内存监控

    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

  • 相关阅读:
    BugKu web 矛盾
    BugKu 域名解析
    Dummy game
    BugKu 变量1
    BugKu web5
    递归算法
    Django进阶(转载)
    centos 7防火情配置
    cenos7切换阿里源
    centos7 编译安装nginx
  • 原文地址:https://www.cnblogs.com/fanxuanhui-linux/p/6242979.html
Copyright © 2011-2022 走看看