-
Notifications
You must be signed in to change notification settings - Fork 67
/
performance-analyzer-agent
executable file
·48 lines (41 loc) · 1.6 KB
/
performance-analyzer-agent
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
#!/bin/bash
if [ "$START_PERF_ANALYZER" = "false" ]; then
echo "Not starting performance-analyzer-agent"
exit 0
fi
if [ -z "$1" ]; then
if [ -z "$OPENSEARCH_HOME" ]; then
echo "OPENSEARCH_HOME needs to be set or passed in as the first parameter."
exit 1
fi
else
OPENSEARCH_HOME=$1
fi
if [ -z "$2" ]; then
if [ -z "$JAVA_HOME" ]; then
echo "JAVA_HOME needs to be set or passed in as the second parameter."
exit 1
fi
else
JAVA_HOME=$2
fi
# Instead of the supervisor executing performance-analyzer-agent from the plugin location,
# we should move this to the reader. The entry-point script should be executing
# performance-analyzer-agent from the reader location.
# We need to change this file: https://github.com/opensearch-project/opensearch-build/blob/main/release/docker/config/opensearch/opensearch-docker-entrypoint.sh
if ! echo $* | grep -E '(^-d |-d$| -d |--daemonize$|--daemonize )' >/dev/null; then
export JAVA_OPTS=-Dopensearch.path.home=$OPENSEARCH_HOME\ -Dlog4j.configurationFile=$OPENSEARCH_HOME/performance-analyzer-rca-1.3.0-SNAPSHOT/pa_config/log4j2.xml
exec $OPENSEARCH_HOME/performance-analyzer-rca-1.3.0-SNAPSHOT/bin/performance-analyzer-rca
else
echo 'Starting deamon'
export JAVA_OPTS=-Dopensearch.path.home=$OPENSEARCH_HOME\ -Dlog4j.configurationFile=$OPENSEARCH_HOME/performance-analyzer-rca-1.3.0-SNAPSHOT/pa_config/log4j2.xml
exec $OPENSEARCH_HOME/performance-analyzer-rca-1.3.0-SNAPSHOT/bin/performance-analyzer-rca &
pid=$!
PID_LOC=/tmp/performance-analyzer-agent
if [ -n "$4" ]; then
PID_LOC=$4
fi
if ! ps -p $pid >$PID_LOC; then
exit 1
fi
fi