Skip to content

Instantly share code, notes, and snippets.

@tant4lus
Last active August 29, 2015 14:02
Show Gist options
  • Save tant4lus/9967fa590235afd6decb to your computer and use it in GitHub Desktop.
Save tant4lus/9967fa590235afd6decb to your computer and use it in GitHub Desktop.
Weblogic Thread Dump Script
# Based on Oracle Support Note 1274713.1
# https://support.oracle.com/epmos/faces/DocumentDisplay?_adf.ctrl-state=14sej99wm2_117&id=1274713.1
# Takes 5 thread dumps on each managed server connected to the AdminServer
# Thread dumps are taken 15 seconds apart
# Connects using a user userFile and keyFile
from time import strftime
from java.text import SimpleDateFormat
login_UserFile = raw_input('Enter path of userUserFile : ')
login_KeyFile = raw_input('Enter path of userKeyFile : ')
serverName = raw_input('Enter name of server to threaddump on : ')
weblogicURL = raw_input ('Enter the URL to connect to (i.e. t3s://hostname.domain.com:7002) : ')
# This module for managed Servers list
def getRunningServerNames():
domainConfig()
serverNames = cmo.getServers()
return serverNames
connect(userConfigFile=login_UserFile,userKeyFile=login_KeyFile,url=weblogicURL)
serverNames = getRunningServerNames()
counter = 0
sleepTime = 15000
threadNumber = 5
for counter in range(threadNumber):
currentDate = java.util.Date().toString()
myDate = currentDate.split(' ');
finalDate = myDate[3]
java.lang.Thread.sleep(sleepTime)
for server in serverNames:
name = server.getName()
try:
fileName = 'dump' + '_' + name + '_' + finalDate + '.dmp'
threadDump('true', fileName, name)
except WLSTException,e:
pass
disconnect()
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment