zoukankan      html  css  js  c++  java
  • 排查java 内存CPU报警

    #!/bin/bash
    
    source /etc/profile
    
    
    #接收外部传入PID,任选一种
    #servicePid=$1
    
    headPid=`ps auxw|sort -rn -k3|head -4|sed -n '1,4p'`
    echo "${headPid}" > headPid.log
    
    
    servicePid=`ps auxw|sort -rn -k3|head -2|sed -n '1p'|awk '{print $2}'`
    #rm -rf ./jstack.out
    /alidata/jdk1.7.0_79/bin/jstack -l ${servicePid} > jstack.out
    
    #查看该进程的线程情况,排查进程中哪些线程占用率很高,排名前10
    showPidmessage=`ps -mp ${servicePid} -o THREAD,tid,time|sort -rn|head -n 10|awk '{print $8}'|sed -n '2,10p'|grep -v '-'`
    rm -rf ./showMessage.log
    
    for i in $showPidmessage
    do
    id=`printf '%x
    ' $i`
    echo "进程PID:${servicePid},子线程:$i,16进制数值:$id" >> showMessage.log
    done
    
    showPid=`ps -mp ${servicePid} -o THREAD,tid,time|sort -rn|head -n 10|awk '{print $2,$8,$9}'|sed -n '2,10p'|grep -v '-'|sort -rn`
    echo "线程CPU占用率 线程ID 运行时长" > showPid.log
    echo "${showPid}" > showPid.log
    
    echo "this is ok"
  • 相关阅读:
    对bootstrap不同版本的总结
    对于前后端分离的理解
    css3笔记
    Dom
    js菜单
    css兼容问题 ie6,7
    html知识
    前端基础知识
    前端要注意的代码规范
    bootstrap常见类的总结
  • 原文地址:https://www.cnblogs.com/ipyanthony/p/11352936.html
Copyright © 2011-2022 走看看