Skip to content

Commit

Permalink
Merge pull request #3280 from arunans23/diagnostics
Browse files Browse the repository at this point in the history
Include Runtime diagnostics tool into the server
  • Loading branch information
arunans23 authored Mar 21, 2024
2 parents c91e6bd + 902ba04 commit 4845814
Show file tree
Hide file tree
Showing 7 changed files with 433 additions and 2 deletions.
25 changes: 25 additions & 0 deletions distribution/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -108,6 +108,22 @@
<groupId>com.lmax</groupId>
<artifactId>disruptor</artifactId>
</dependency>
<dependency>
<groupId>org.apache.commons</groupId>
<artifactId>commons-math3</artifactId>
</dependency>
<dependency>
<groupId>commons-net</groupId>
<artifactId>commons-net</artifactId>
</dependency>
<dependency>
<groupId>com.github.mwiede</groupId>
<artifactId>jsch</artifactId>
</dependency>
<dependency>
<groupId>org.wso2.runtime.diagnostics</groupId>
<artifactId>runtime-diagnostics-tool</artifactId>
</dependency>
</dependencies>
<build>
<plugins>
Expand All @@ -132,6 +148,15 @@
<overWrite>true</overWrite>
<outputDirectory>target</outputDirectory>
</artifactItem>
<artifactItem>
<groupId>org.wso2.runtime.diagnostics</groupId>
<artifactId>runtime-diagnostics-tool</artifactId>
<version>${diagnostics.tool.version}</version>
<type>zip</type>
<overWrite>true</overWrite>
<outputDirectory>target</outputDirectory>
<destFileName>diagnostics-tool</destFileName>
</artifactItem>
</artifactItems>
</configuration>
</execution>
Expand Down
30 changes: 30 additions & 0 deletions distribution/src/assembly/bin.xml
Original file line number Diff line number Diff line change
Expand Up @@ -190,6 +190,25 @@
</excludes>
</fileSet>

<fileSet>
<directory>target/diagnostics-tool</directory>
<outputDirectory>wso2mi-${pom.version}/diagnostics-tool</outputDirectory>
<excludes>
<exclude>bin/diagnostics</exclude>
<exclude>lib/**</exclude>
</excludes>
</fileSet>

<fileSet>
<directory>src/scripts/</directory>
<outputDirectory>${pom.artifactId}-${pom.version}/diagnostics-tool/bin
</outputDirectory>
<includes>
<include>**/diagnostics.sh</include>
</includes>
<fileMode>755</fileMode>
</fileSet>

<fileSet>
<directory>src/conf</directory>
<outputDirectory>wso2mi-${pom.version}/bin</outputDirectory>
Expand Down Expand Up @@ -600,6 +619,13 @@
<filtered>true</filtered>
<fileMode>644</fileMode>
</file>
<file>
<source>src/resources/config-tool/templates/diagnostics-tool/conf/config.toml.j2</source>
<outputDirectory>wso2mi-${pom.version}/repository/resources/conf/templates/diagnostics-tool/conf</outputDirectory>
<destName>config.toml.j2</destName>
<filtered>true</filtered>
<fileMode>644</fileMode>
</file>
<file>
<source>src/conf/sec.policy</source>
<outputDirectory>wso2mi-${pom.version}/conf</outputDirectory>
Expand Down Expand Up @@ -644,6 +670,10 @@
<include>org.apache.logging.log4j:log4j-jcl:jar</include>
<include>org.slf4j:slf4j-simple:jar</include>
<include>com.lmax:disruptor:jar</include>
<include>org.apache.commons:commons-math3:jar</include>
<include>commons-net:commons-net</include>
<include>com.github.mwiede:jsch</include>
<include>org.wso2.runtime.diagnostics:runtime-diagnostics-tool:jar</include>
<!--
javax jms-api need to be in class path for axis2
( needs javax.jms.JMSException )
Expand Down
60 changes: 58 additions & 2 deletions distribution/src/resources/config-tool/default.json
Original file line number Diff line number Diff line change
Expand Up @@ -692,6 +692,62 @@
"user_store.base_dn": "dc=wso2,dc=org",

"transport.jms.sender_class": "org.apache.axis2.transport.jms.JMSSender",
"transport.jms.listener_class": "org.apache.axis2.transport.jms.JMSListener"

"transport.jms.listener_class": "org.apache.axis2.transport.jms.JMSListener",
"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"
},
"cpu_watcher": {
"enabled": "true",
"threshold": "80",
"retry_count": "2",
"interval": "5",
"action_executors": "ThreadDumper,MetricsSnapshot,ServerInfo"
},
"memory_watcher": {
"enabled": "true",
"threshold": "80",
"retry_count": "2",
"interval": "5",
"action_executors": "ThreadDumper,MetricsSnapshot,ServerInfo"
},
"log_watcher": {
"enabled": "true",
"interval": 0.1
},
"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"
},
"zip_file_configuration": {
"output_directory": "data",
"max_count": "20"
},
"log_pattern.patterns": [
{
"pattern.regex": "(.*)org.apache.synapse.transport.passthru(.*)",
"pattern.executors": "MetricsSnapshot,Netstat,OpenFileFinder,ThreadDumper,ServerInfo",
"pattern.reload_time": "30"
},
{
"pattern.regex": "(.*)org.apache.synapse(.*)",
"pattern.executors": "ServerInfo",
"pattern.reload_time": "10"
}
]
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,143 @@
#
# Copyright (c) 2024, WSO2 LLC. (http://www.wso2.org) All Rights Reserved.
#
# WSO2 LLC. licenses this file to you 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.
#
#
##############################################
#
# WARNING: Don't edit the file manually unless you are not using the deployment.toml file.
#
##############################################

## This file contains the configuration parameters used by the Diagnostic tool

# Server Configurations
[server_configuration]
deployment_toml_path = "{{server_configuration.deployment_toml_path}}"
logs_directory = "{{server_configuration.logs_directory}}"
updates_config_path = "{{server_configuration.updates_config_path}}"
diagnostic_log_file_path = "{{server_configuration.diagnostic_log_file_path}}"
carbon_log_file_path = "{{server_configuration.carbon_log_file_path}}"
process_id_path = "{{server_configuration.process_id_path}}"
server_name = "@product.name@"
server_version = "@product.version@"

## Action Executor Configurations

# Example
#[[action_executor_configuration]]
#executor = "ActionExecutor"
#reload_time = "180" # in seconds

[[action_executor_configuration]]
executor = "MemoryDumper"
reload_time = "180"

[[action_executor_configuration]]
executor = "ThreadDumper"
count = "5"
delay = "2000"

[[action_executor_configuration]]
executor = "OpenFileFinder"

[[action_executor_configuration]]
executor = "Netstat"
command = "netstat -alt"

[[action_executor_configuration]]
executor = "ServerInfo"

[[action_executor_configuration]]
executor = "MetricsSnapshot"

{%for action in action_executor_configuration %}
[[action_executor_configuration]]
executor = "{{action.executor}}"
{% endfor %}

# Watcher Configurations
[cpu_watcher]
enabled = "{{cpu_watcher.enabled}}"
threshold = "{{cpu_watcher.threshold}}"
retry_count = "{{cpu_watcher.retry_count}}"
interval = "{{cpu_watcher.interval}}"
action_executors = "{{cpu_watcher.action_executors}}"

[memory_watcher]
enabled = "{{memory_watcher.enabled}}"
threshold = "{{memory_watcher.threshold}}"
retry_count = "{{memory_watcher.retry_count}}"
interval = "{{memory_watcher.interval}}"
action_executors = "{{memory_watcher.action_executors}}"

[log_watcher]
enabled = "{{log_watcher.enabled}}"
interval = {{log_watcher.interval}}

# Traffic Analyzer Configurations
[traffic_analyzer]
last_second_requests_enabled = "{{traffic_analyzer.last_second_requests_enabled}}"
last_second_requests_windows_size = "{{traffic_analyzer.last_second_requests_windows_size}}"
last_second_requests_delay = "{{traffic_analyzer.last_second_requests_delay}}"
last_second_requests_interval = "{{traffic_analyzer.last_second_requests_interval}}"
last_fifteen_seconds_requests_enabled = "{{traffic_analyzer.last_fifteen_seconds_requests_enabled}}"
last_fifteen_seconds_requests_window_size = "{{traffic_analyzer.last_fifteen_seconds_requests_window_size}}"
last_fifteen_seconds_requests_delay = "{{traffic_analyzer.last_fifteen_seconds_requests_delay}}"
last_fifteen_seconds_requests_interval = "{{traffic_analyzer.last_fifteen_seconds_requests_interval}}"
last_minutes_requests_enabled = "{{traffic_analyzer.last_minutes_requests_enabled}}"
last_minutes_requests_window_size = "{{traffic_analyzer.last_minutes_requests_window_size}}"
last_minutes_requests_delay = "{{traffic_analyzer.last_minutes_requests_delay}}"
last_minutes_requests_interval = "{{traffic_analyzer.last_minutes_requests_interval}}"
notify_interval = "{{traffic_analyzer.notify_interval}}"

# Output data zip configurations
[zip_file_configuration]
output_directory = "{{zip_file_configuration.output_directory}}"
max_count = "{{zip_file_configuration.max_count}}"

# Error regex patterns and diagnosis
{%for pattern in log_pattern.patterns %}
[[log_pattern]]
regex = "{{pattern.pattern.regex}}"
executors = "{{pattern.pattern.executors}}"
reload_time = "{{pattern.pattern.reload_time}}"

{% endfor %}

{% if ftp_uploader is defined %}
## FTP Uploader configurations
[ftp_uploader]
enabled = "{{ftp_uploader.enabled}}"
host = "{{ftp_uploader.host}}"
port = "{{ftp_uploader.port}}"
username = "{{ftp_uploader.username}}"
password = "{{ftp_uploader.password}}"
directory = "{{ftp_uploader.directory}}"
{% endif %}

{% if sftp_uploader is defined %}
## SFTP Uploader configurations
[sftp_uploader]
enabled = "{{sftp_uploader.enabled}}"
host = "{{sftp_uploader.host}}"
port = "{{sftp_uploader.port}}"
username = "{{sftp_uploader.username}}"
password = "{{sftp_uploader.password}}"
directory = "{{sftp_uploader.directory}}"
known_hosts_path = "{{sftp_uploader.known_hosts_path}}"
strict_host_key_checking = "{{sftp_uploader.strict_host_key_checking}}"
{% endif %}
Loading

0 comments on commit 4845814

Please sign in to comment.