forked from wso2/micro-integrator
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
7 changed files
with
846 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
116 changes: 116 additions & 0 deletions
116
distribution/src/resources/config-tool/templates/diagnostics-tool/conf/config.toml.j2
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,116 @@ | ||
# Server Configurations | ||
[server_configuration] | ||
deployment_toml_path = "../conf/deployment.toml" | ||
logs_directory = "../repository/logs" | ||
updates_config_path = "../updates/config.json" | ||
diagnostic_log_file_path = "logs/diagnostics.log" | ||
carbon_log_file_path = "../repository/logs/wso2error.log" | ||
process_id_path = "../wso2carbon.pid" | ||
server_name = "WSO2 Micro Integrator" | ||
server_version = "4.3.0" | ||
|
||
|
||
## Action Executor Configurations | ||
|
||
# Example | ||
#[[action_executor_configuration]] | ||
#executor = "ActionExecutor" | ||
|
||
[[action_executor_configuration]] | ||
executor = "MemoryDumper" | ||
|
||
[[action_executor_configuration]] | ||
executor = "ThreadDumper" | ||
count = "5" | ||
delay = "2000" | ||
|
||
[[action_executor_configuration]] | ||
executor = "OpenFileFinder" | ||
|
||
[[action_executor_configuration]] | ||
executor = "Netstat" | ||
|
||
[[action_executor_configuration]] | ||
executor = "ServerInfo" | ||
|
||
[[action_executor_configuration]] | ||
executor = "MetricsSnapshot" | ||
|
||
# Watcher Configurations | ||
[cpu_watcher] | ||
enabled = "true" | ||
threshold = "20" | ||
retry_count = "2" | ||
interval = "5" | ||
action_executors = "ThreadDumper,MetricsSnapshot,ServerInfo" | ||
|
||
[memory_watcher] | ||
enabled = "true" | ||
threshold = "30" | ||
retry_count = "2" | ||
interval = "5" | ||
action_executors = "ThreadDumper,MetricsSnapshot,ServerInfo" | ||
|
||
|
||
[log_watcher] | ||
enabled = "true" | ||
|
||
# Traffic Analyzer Configurations | ||
[traffic_analyzer] | ||
last_second_requests_enabled = "false" | ||
last_second_requests_windows_size = "300" | ||
last_second_requests_delay = "60" | ||
last_second_requests_interval = "1" | ||
last_fifteen_seconds_requests_enabled = "true" | ||
last_fifteen_seconds_requests_window_size = "100" | ||
last_fifteen_seconds_requests_delay = "4" | ||
last_fifteen_seconds_requests_interval = "15" | ||
last_minutes_requests_enabled = "true" | ||
last_minutes_requests_window_size = "100" | ||
last_minutes_requests_delay = "1" | ||
last_minutes_requests_interval = "60" | ||
notify_interval = "60" | ||
|
||
# Output data zip configurations | ||
|
||
[zip_file_configuration] | ||
output_directory = "data" | ||
max_count = "50" | ||
|
||
## FTP Uploader configurations | ||
#[ftp_uploader] | ||
#enabled = "true" | ||
#host = "ftp.example.com" | ||
#port = "21" | ||
#username = "username" | ||
#password = "password" | ||
#directory = "diagnostics" | ||
|
||
## SFTP Uploader configurations | ||
#[sftp_uploader] | ||
#enabled = "true" | ||
#host = "sftp.example.com" | ||
#port = "22" | ||
#username = "username" | ||
#password = "password" | ||
#directory = "diagnostics" | ||
#known_hosts_path = "/home/user/.ssh/known_hosts" | ||
#strict_host_key_checking = "yes" # or "no" | ||
|
||
# Error regex patterns and diagnosis | ||
|
||
# Example | ||
#[[log_pattern]] | ||
#regex = "(.*)Timeout(.*)" | ||
#executors = "MetricsSnapshot,Netstat,OpenFileFinder,ServerInfo" | ||
#reload_time = "30" | ||
|
||
[[log_pattern]] | ||
regex = "(.*)org.apache.synapse.transport.passthru(.*)" | ||
executors = "MetricsSnapshot,Netstat,OpenFileFinder,ThreadDumper,ServerInfo" | ||
reload_time = "30" | ||
|
||
[[log_pattern]] | ||
regex = "(.*)org.apache.synapse(.*)" | ||
executors = "ServerInfo" | ||
reload_time = "10" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,134 @@ | ||
#!/bin/sh | ||
# diagnostics.sh | ||
# ---------------------------------------------------------------------------- | ||
# Copyright 2024 WSO2, LLC. http://www.wso2.org | ||
# | ||
# Licensed under the Apache License, Version 2.0 (the "License"); | ||
# you may not use this file except in compliance with the License. | ||
# You may obtain a copy of the License at | ||
# | ||
# http://www.apache.org/licenses/LICENSE-2.0 | ||
# | ||
# Unless required by applicable law or agreed to in writing, software | ||
# distributed under the License is distributed on an "AS IS" BASIS, | ||
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
# See the License for the specific language governing permissions and | ||
# limitations under the License. | ||
|
||
|
||
# resolve links - $0 may be a softlink | ||
PRG="$0" | ||
|
||
while [ -h "$PRG" ]; do | ||
ls=`ls -ld "$PRG"` | ||
link=`expr "$ls" : '.*-> \(.*\)$'` | ||
if expr "$link" : '/.*' > /dev/null; then | ||
PRG="$link" | ||
else | ||
PRG=`dirname "$PRG"`/"$link" | ||
fi | ||
done | ||
|
||
PRGDIR=`dirname "$PRG"` | ||
BASEDIR=`cd "$PRGDIR/.." >/dev/null; pwd` | ||
|
||
# Reset the REPO variable. If you need to influence this use the environment setup file. | ||
REPO= | ||
|
||
|
||
# OS specific support. $var _must_ be set to either true or false. | ||
cygwin=false; | ||
darwin=false; | ||
case "`uname`" in | ||
CYGWIN*) cygwin=true ;; | ||
Darwin*) darwin=true | ||
if [ -z "$JAVA_VERSION" ] ; then | ||
JAVA_VERSION="CurrentJDK" | ||
else | ||
echo "Using Java version: $JAVA_VERSION" | ||
fi | ||
if [ -z "$JAVA_HOME" ]; then | ||
if [ -x "/usr/libexec/java_home" ]; then | ||
JAVA_HOME=`/usr/libexec/java_home` | ||
else | ||
JAVA_HOME=/System/Library/Frameworks/JavaVM.framework/Versions/${JAVA_VERSION}/Home | ||
fi | ||
fi | ||
;; | ||
esac | ||
|
||
if [ -z "$JAVA_HOME" ] ; then | ||
if [ -r /etc/gentoo-release ] ; then | ||
JAVA_HOME=`java-config --jre-home` | ||
fi | ||
fi | ||
|
||
# For Cygwin, ensure paths are in UNIX format before anything is touched | ||
if $cygwin ; then | ||
[ -n "$JAVA_HOME" ] && JAVA_HOME=`cygpath --unix "$JAVA_HOME"` | ||
[ -n "$CLASSPATH" ] && CLASSPATH=`cygpath --path --unix "$CLASSPATH"` | ||
fi | ||
|
||
# If a specific java binary isn't specified search for the standard 'java' binary | ||
if [ -z "$JAVACMD" ] ; then | ||
if [ -n "$JAVA_HOME" ] ; then | ||
if [ -x "$JAVA_HOME/jre/sh/java" ] ; then | ||
# IBM's JDK on AIX uses strange locations for the executables | ||
JAVACMD="$JAVA_HOME/jre/sh/java" | ||
else | ||
JAVACMD="$JAVA_HOME/bin/java" | ||
fi | ||
else | ||
JAVACMD=`which java` | ||
fi | ||
fi | ||
|
||
if [ ! -x "$JAVACMD" ] ; then | ||
echo "Error: JAVA_HOME is not defined correctly." 1>&2 | ||
echo " We cannot execute $JAVACMD" 1>&2 | ||
exit 1 | ||
fi | ||
|
||
if [ -z "$REPO" ] | ||
then | ||
REPO="$BASEDIR"/../wso2/lib | ||
fi | ||
|
||
CLASSPATH="$BASEDIR"/conf:"$REPO"/* | ||
|
||
ENDORSED_DIR= | ||
if [ -n "$ENDORSED_DIR" ] ; then | ||
CLASSPATH=$BASEDIR/$ENDORSED_DIR/*:$CLASSPATH | ||
fi | ||
|
||
if [ -n "$CLASSPATH_PREFIX" ] ; then | ||
CLASSPATH=$CLASSPATH_PREFIX:$CLASSPATH | ||
fi | ||
|
||
if [ -z "$JVM_MEM_OPTS" ]; then | ||
java_version=$("$JAVACMD" -version 2>&1 | awk -F '"' '/version/ {print $2}') | ||
JVM_MEM_OPTS="-Xms32m -Xmx128m" | ||
if [ "$java_version" \< "1.8" ]; then | ||
JVM_MEM_OPTS="$JVM_MEM_OPTS" | ||
fi | ||
fi | ||
|
||
# For Cygwin, switch paths to Windows format before running java | ||
if $cygwin; then | ||
[ -n "$CLASSPATH" ] && CLASSPATH=`cygpath --path --windows "$CLASSPATH"` | ||
[ -n "$JAVA_HOME" ] && JAVA_HOME=`cygpath --path --windows "$JAVA_HOME"` | ||
[ -n "$HOME" ] && HOME=`cygpath --path --windows "$HOME"` | ||
[ -n "$BASEDIR" ] && BASEDIR=`cygpath --path --windows "$BASEDIR"` | ||
[ -n "$REPO" ] && REPO=`cygpath --path --windows "$REPO"` | ||
fi | ||
|
||
exec "$JAVACMD" $JAVA_OPTS \ | ||
$JVM_MEM_OPTS \ | ||
-classpath "$CLASSPATH" \ | ||
-Dapp.name="runtime-diagnostics" \ | ||
-Dapp.pid="$$" \ | ||
-Dapp.repo="$REPO" \ | ||
-Dapp.home="$BASEDIR" \ | ||
-Dbasedir="$BASEDIR" \ | ||
org.wso2.diagnostics.DiagnosticsApp \ | ||
"$@" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.