定时抓取服务器状态
#! /bin/sh
#get_current_time 特别注意以下几个必须手动引出,手动执行时和在crontab -e 中执行中环境不一样
export JAVA_HOME=/opt/jdk1.6.0_10/
export PATH=$JAVA_HOME/bin:$PATH
export CLASSPATH=.:$JAVA_HOME/lib/tools.jar:$JAVA_HOME/lib/dt.jar:$CLASSPATH
date=`date "+%Y-%m-%d-%H:%M:%S"`
Root="/data/dxm/"
jmapends=$Root$date"_jmap.txt"
jstackends=$Root$date"_jstack.txt"
jstateends=$Root$date"_jstate.txt"
#start to register the jmap message
echo "start to register the jmap to "$jmapends
jmap -histo:live `jps|grep Resin |awk 'NR==1'|awk '{print $1}'` > $jmapends
sleep 2
#start to register the jtack message
echo "start to register the jstack to "$jstackends
jstack -l `jps|grep Resin |awk 'NR==1'|awk '{print $1}'` > $jstackends
sleep 2
#start to register the jstate message
echo "start to register the jstate message to "$jstateends
jstat -gcutil -t -h20 `jps|grep Resin |awk 'NR==1'|awk '{print $1}'` 1000 20 > $jstateends
作者“狼之梦---爱乌及屋”
相关新闻>>
- 发表评论
-
- 最新评论 更多>>