Skip to content

Commit

Permalink
Get JVM metrics from Windows (#145)
Browse files Browse the repository at this point in the history
* Make jvm metrics collection support in windows

* Fix code to change wso2server.bat in windows
  • Loading branch information
tharindu1992 authored and yasassri committed Sep 18, 2018
1 parent 718f5b5 commit 5303a37
Show file tree
Hide file tree
Showing 2 changed files with 25 additions and 10 deletions.
33 changes: 24 additions & 9 deletions integration-tests/configure_product.py
Original file line number Diff line number Diff line change
Expand Up @@ -147,16 +147,31 @@ def modify_pom_files():
def attach_jolokia_agent(spath):
logger.info('attaching jolokia agent as a java agent')
sp = str(spath)
with open(sp, "r") as in_file:
buf = in_file.readlines()

with open(sp, "w") as out_file:
for line in buf:
if line == " $JAVACMD \\\n":
line = line + " -javaagent:/opt/wso2/jolokia-jvm-1.6.0-agent.jar=port=8778,host=localhost,protocol=http \\\n"
logger.info(line)
out_file.write(line)

if sys.platform.startswith('win'):
sp = sp + ".bat"
jolokia_agent = "-javaagent:C:\\testgrid\\jolokia-jvm-1.6.0-agent.jar=port=8778,host=localhost,protocol=http "
with open(sp, "r") as in_file:
buf = in_file.readlines()
with open(sp, "w") as out_file:
for line in buf:
if line.startswith("set CMD_LINE_ARGS"):
newline = str(line).replace("CMD_LINE_ARGS=", 'CMD_LINE_ARGS='+jolokia_agent)
line = newline
logger.info(newline)
out_file.write(line)
else:
sp = sp + ".sh"
jolokia_agent = \
" -javaagent:/opt/wso2/jolokia-jvm-1.6.0-agent.jar=port=8778,host=localhost,protocol=http \\\n"
with open(sp, "r") as in_file:
buf = in_file.readlines()
with open(sp, "w") as out_file:
for line in buf:
if line == " $JAVACMD \\\n":
line = line + jolokia_agent
logger.info(line)
out_file.write(line)

def modify_datasources():
"""Modify datasources files which are defined in the const.py. DB ulr, uname, pwd, driver class values are modifying.
Expand Down
2 changes: 1 addition & 1 deletion integration-tests/const.py
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@
"product-is": "modules/distribution/target",
"product-ei": "modules/distribution/target"}
PRODUCT_STORAGE_DIR_NAME = "storage"
WSO2SERVER = "bin/wso2server.sh"
WSO2SERVER = "bin/wso2server"
TEST_PLAN_PROPERTY_FILE_NAME = "testplan-props.properties"
INFRA_PROPERTY_FILE_NAME = "infrastructure.properties"
LOG_FILE_NAME = "integration.log"
Expand Down

0 comments on commit 5303a37

Please sign in to comment.