Professional Documents
Culture Documents
FullMonitering Py
FullMonitering Py
import os
import sys
# Connect to server
url = 't3://' + parServerName + ':7001'
connect(uname, pwd, url)
#----------------------------------------
# Report Server Status
#----------------------------------------
fo.write('<div>')
fo.write('\n<h3>SERVER STATUS REPORT: ' + url + '</h3>\n\n')
def getRunningServerNames():
domainConfig()
return cmo.getServers()
serverNames = getRunningServerNames()
domainRuntime()
def healthstat(server_name):
cd('/ServerRuntimes/' + server_name + '/ThreadPoolRuntime/ThreadPoolRuntime')
s = get('HealthState')
x = s.toString().split(',')[2].split(':')[1].split('HEALTH_')[1]
return x
serverNames = domainRuntimeService.getServerRuntimes()
getRunningServerNames()
domainRuntime()
rowNum = 0;
if status != 'RUNNING':
if status == 'WARNING':
fo.write('<tr align="center" bgcolor=' + rowColor + '><td> ALERT!' +
name.getName() + ' </td><td>' + status + '</td><td style="background-color:' +
hcolor + ';font-weight:bold;">' + health + '</td></tr>')
else:
fo.write('<tr align="center" bgcolor=' + rowColor + '><td> ALERT!' +
name.getName() + ' </td><td> ' + status + ' </td><td style="background-color:' +
hcolor + ';font-weight:bold;">' + health + '</td></tr>')
else:
fo.write('<tr align="center" bgcolor=' + rowColor + '><td> ' +
name.getName() + ' </td><td> ' + status + ' </td><td style="background-color:' +
hcolor + ';"><b>' + health + ' </b></td></tr> ')
rowNum += 1
fo.write("</table><br/><br/>")
#----------------------------------------
# Report Heap Details
#----------------------------------------
#----------------------------------------
# Report JDBC Status
#----------------------------------------
if datasource.getState() != "Running":
stateColor = "red"
else:
stateColor = rowColor
if datasource.getActiveConnectionsCurrentCount() > 10:
acColor = "yellow"
if datasource.getActiveConnectionsCurrentCount() > 20:
acColor = "red"
else:
acColor = rowColor
if datasource.getWaitingForConnectionCurrentCount() > 2:
wcColor = "yellow"
if datasource.getWaitingForConnectionCurrentCount() > 5:
wcColor = "red"
else:
wcColor = rowColor
#----------------------------------------
# Report JMS Status
#----------------------------------------
#----------------------------------------
# Exit WLST
#----------------------------------------
exit()