'전체 글'에 해당되는 글 240건

Java Dump creation script

DevOps 2020. 1. 15. 18:01

#!/bin/sh
if [[ $# -ne 1 ]]
then
echo 'Usage: th_info.sh '
echo "-------------------------------------------------------------------"
jps
exit
fi




export jpid=$1
export top_cpu_count=20
export thread_info=${jpid}_thread_info_`date +%Y%m%d_%H%M%S`.txt


export tmp_dex_thread_id=tmp_dex_thread_id.tmp
export tmp_hex_thread_id=tmp_hex_thread_id.tmp


echo "-------------------------------------------------------------------" >> ${thread_info}
echo " CPU usage per thread in JVM ${jpid}   "`date +%Y/%m/%d_%H:%M:%S`    >> ${thread_info}
echo "-------------------------------------------------------------------" >> ${thread_info}
echo " ThreadID(HEX)  ThreadID(DEC)  Usage"                                >> ${thread_info}


ps -mo pcpu,lwp -p ${jpid}| awk '{if ($2 ~/[0-9]/) {print $2 " " $1""}}'  | sort -k 2 -r  | head -n ${top_cpu_count}  > ./${tmp_dex_thread_id}
cat ./${tmp_dex_thread_id} | awk '{print $1}' | xargs printf "%x\n"  > ./${tmp_hex_thread_id}
paste  ./${tmp_hex_thread_id}  ./${tmp_dex_thread_id}                      >> ./${thread_info}


echo "-------------------------------------------------------------------" >> ${thread_info}
echo " Full thread dump                                                  " >> ${thread_info}
echo "-------------------------------------------------------------------" >> ${thread_info}


jstack ${jpid} >> ${thread_info}


rm ./${tmp_dex_thread_id}  ./${tmp_hex_thread_id}

'DevOps' 카테고리의 다른 글

Ping Test for Tomcat AJP connector  (0) 2020.01.15
GitLab with Docker Image official guide (GitLab)  (0) 2020.01.15
docker cli #01  (0) 2020.01.15
Ansible quick start  (0) 2020.01.15
Git cheat sheet #02  (0) 2020.01.15
블로그 이미지

Melting

,

#!/usr/bin/perl

# AJPING - pings a servlet engine with AJP protocol

# Sends:   \x12\x34\x00\x01\x0a

# Expects: \0x41\0x42\0x00\0x01\0x09

#

use strict;

use Socket;             # Part of perl

use Time::HiRes 'time'; # http://search.cpan.org/~jhi/Time-HiRes-1.9721/HiRes.pm

 

sub xdie;

sub usage;

 

my ($host, $port);

 

if (@ARGV == 2) {

  $host = $ARGV[0];

  $port = $ARGV[1];

} else {

  ($host, $port) = split (/:/, shift @ARGV, 2);

}

 

if (!$host || !$port) {

  usage();

}

 

for (my $i = 0; $i < 10; $i++) {

  my $start = time();

  my $iaddr = inet_aton($host) || xdie("Unknown host ($host)");

  my $paddr = sockaddr_in($port, $iaddr) || xdie ("Unable to establish a socket address");

  my $proto = getprotobyname('tcp');

  socket(my $sock, PF_INET, SOCK_STREAM, $proto) || xdie "Unable to create a socket.";

  connect($sock, $paddr)  || xdie "Unable to connect to server";

  syswrite $sock, "\x12\x34\x00\x01\x0a";

  sysread $sock, my $recv, 5 || die "read: $!, stopped";

  my @vals = unpack 'C5', $recv;

  my @acks = qw (65 66 0 1 9);

  my %vals = map {$_, 1} @vals;

  my @diff = grep {!$vals {$_}} @acks;

 

  if (@diff == 0) {

    use POSIX qw(strftime);

    my ($datestring) = strftime "%a %b %e %H:%M:%S %Y", localtime;

    printf "[$datestring] Reply from $host: %d bytes in %3.3f seconds\n", (length("@vals") - $#vals), (time() - $start);

  } else {

    print "Protocol error: unable to verify AJP host $host:$port\n";

    exit 1;

  }

  close($sock);

  sleep(1);

}

 

exit;

 

sub usage {

  print "ajping - pings a server via AJP protocol\n";

  print "usage: ajping host:port\n";

  print "       ajping host port\n";

  exit;

}

 

sub xdie {

  my $msg = shift;

  printf STDERR "ERROR: $msg\n";

  exit 1;

}

 

'DevOps' 카테고리의 다른 글

Java Dump creation script  (0) 2020.01.15
GitLab with Docker Image official guide (GitLab)  (0) 2020.01.15
docker cli #01  (0) 2020.01.15
Ansible quick start  (0) 2020.01.15
Git cheat sheet #02  (0) 2020.01.15
블로그 이미지

Melting

,

https://docs.gitlab.com/omnibus/docker/

 

 

--------------------------------------------------------------------

sudo docker run --detach \

  --hostname gitlab.example.com \

  --publish 3443:443 --publish 3080:80 --publish 3022:22 \

  --name gitlab \

  --restart always \

  --volume /opt/dev/gitlab/config:/etc/gitlab \

  --volume /opt/dev/gitlab/logs:/var/log/gitlab \

  --volume /opt/dev/gitlab/data:/var/opt/gitlab \

  gitlab/gitlab-ce:latest

--------------------------------------------------------------------

 

--------------------------------------------------------------------

docker-compose.yml

--------------------------------------------------------------------

web:

  image: 'gitlab/gitlab-ce:latest'

  restart: always

  hostname: 'gitlab.example.com'

  environment:

    GITLAB_OMNIBUS_CONFIG: |

      external_url 'https://gitlab.example.com'

      # Add any other gitlab.rb configuration here, each on its own line

  ports:

    - '3080:80'

    - '3443:443'

    - '3022:22'

  volumes:

    - '/opt/dev/gitlab/config:/etc/gitlab'

    - '/opt/dev/gitlab/logs:/var/log/gitlab'

    - '/opt/dev/gitlab/data:/var/opt/gitlab'

--------------------------------------------------------------------

 

 

-  https://blog.sonatype.com/maxences-technical-corner

    >> Using a Dockerized Nexus as a Docker Registry

 

--------------------------------------------------------------------

  nexus-data fold link #01 - bind local directory to nexus

--------------------------------------------------------------------

$ mkdir -p /opt/dev/dockerized_env/nexus/data

$ sudo chown -R 200 /opt/dev/dockerized_env/nexus/data

$ docker run -d --name nexus --restart always -p 3081:8081 -p 3082:8082 -v /opt/dev/dockerized_env/nexus/data:/nexus-data sonatype/nexus3

 

--------------------------------------------------------------------

  nexus-data fold link #02 - using docker volume

--------------------------------------------------------------------

$ docker volume create --name nexus-data  

$ docker volume ls

$ docker run -d --name nexus --restart always -p 3081:8081 -p 3082:8082 -v nexus-data:/nexus-data sonatype/nexus3

 

 

 

 

 

 

'DevOps' 카테고리의 다른 글

Java Dump creation script  (0) 2020.01.15
Ping Test for Tomcat AJP connector  (0) 2020.01.15
docker cli #01  (0) 2020.01.15
Ansible quick start  (0) 2020.01.15
Git cheat sheet #02  (0) 2020.01.15
블로그 이미지

Melting

,