forked from WASdev/sample.pmi.prometheus.grafana
-
Notifications
You must be signed in to change notification settings - Fork 0
/
install_app.py
91 lines (64 loc) · 2.36 KB
/
install_app.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
import sys
import os
global AdminConfig
def getNodeId (prompt):
nodeList = AdminConfig.list("Node").split("\n")
if (len(nodeList) == 1):
node = nodeList[0]
else:
print ""
print "Available Nodes:"
nodeNameList = []
for item in nodeList:
item = item.rstrip()
name = getName(item)
nodeNameList.append(name)
print " " + name
DefaultNode = nodeNameList[0]
if (prompt == ""):
prompt = "Select the desired node"
nodeName = getValidInput(prompt+" ["+DefaultNode+"]:", DefaultNode, nodeNameList )
index = nodeNameList.index(nodeName)
node = nodeList[index]
return node
def getServerId (prompt):
serverList = AdminConfig.list("Server").split("\n")
if (len(serverList) == 1):
server = serverList[0]
else:
print ""
print "Available Servers:"
serverNameList = []
for item in serverList:
item = item.rstrip()
name = getName(item)
serverNameList.append(name)
print " " + name
DefaultServer = serverNameList[0]
if (prompt == ""):
prompt = "Select the desired server"
serverName = getValidInput(prompt+" ["+DefaultServer+"]:", DefaultServer, serverNameList )
index = serverNameList.index(serverName)
server = serverList[index]
return server
def getName (objectId):
endIndex = (objectId.find("(c") - 1)
stIndex = 0
if (objectId.find("\"") == 0):
stIndex = 1
return objectId[stIndex:endIndex+1]
node = getName(getNodeId(""))
server = getName(getServerId(""))
print "Installing Default application ..."
parms = "-appname DefaultApplication"
parms += " -node " + node + " -server " + server
parms += " -nouseMetaDataFromBinary"
app = AdminApp.install("/opt/IBM/WebSphere/AppServer/installableApps/DefaultApplication.ear", [parms])
AdminConfig.save()
print "Installing Metrics application ..."
metricsParms = "-appname MetricsApp"
metricsParms += " -node " + node + " -server " + server
metricsParms += " -nouseMetaDataFromBinary"
metricsApp = AdminApp.install("/opt/IBM/WebSphere/AppServer/installableApps/metrics.ear", [metricsParms])
AdminTask.setGenericJVMArguments('[-nodeName ' + node + ' -serverName ' + server + ' -genericJvmArguments "-Xnoloa"]')
AdminConfig.save()