ABOUT ME

-

Today
-
Yesterday
-
Total
-
  • jcmd (java process memory monitoring)
    IT/shell 2021. 2. 8. 16:41
    #!/bin/bash
    pid=$(jps | grep external-web.jar | awk -F " " '{print $1}')
    da=$(date +%Y%m%d%H%M%S)
    da1=$(date +%Y%m%d)
    echo "=start file $da=" >>/logs/reso/external-web/log/$da1"_"resource.log
    echo "date|reserved|committed_1|malloc|mmap|committed_2" >>/logs/reso/external-web/log/$da1"_"resource.log
    while true; do
      da2=$(date +%Y%m%d%H%M%S)
      da3=$(date +%Y%m%d)
      real1=$(jcmd $pid VM.native_memory | grep -A 2 "Internal" | awk -v FS="(=|KB)" '{print $2}' | head -n 1 | tail -1)
      real2=$(jcmd $pid VM.native_memory | grep -A 2 "Internal" | awk -v FS="(=|KB)" '{print $4}' | head -n 1 | tail -1)
      real3=$(jcmd $pid VM.native_memory | grep -A 2 "Internal" | awk -v FS="(=|KB)" '{print $2}' | head -n 2 | tail -1)
      real4=$(jcmd $pid VM.native_memory | grep -A 2 "Internal" | awk -v FS="(=|KB)" '{print $2}' | head -n 3 | tail -1)
      real5=$(jcmd $pid VM.native_memory | grep -A 2 "Internal" | awk -v FS="(=|KB)" '{print $4}' | head -n 3 | tail -1)
      echo $da2"|"$real1"|"$real2"|"$real3"|"$real4"|"$real5 >>/logs/reso/external-web/log/$da3"_"resource.log
      sleep 1
    done
    

    javaprocess  memory monitoring

    aa
    
    some code...
    some code...
    
    some code...
    p{font-size:4px}
    

    'IT > shell' 카테고리의 다른 글

    curl 부하주기.  (0) 2021.02.08
    linux shell 프로세서 모니터링 script  (0) 2021.02.08

    댓글

Designed by Tistory.