Skip to content

Commit

Permalink
add test
Browse files Browse the repository at this point in the history
  • Loading branch information
sajithaliyanage authored and arunans23 committed Mar 4, 2024
1 parent 9c14f70 commit fa9bf90
Show file tree
Hide file tree
Showing 9 changed files with 711 additions and 87 deletions.
18 changes: 8 additions & 10 deletions distribution/src/assembly/bin.xml
Original file line number Diff line number Diff line change
Expand Up @@ -174,6 +174,7 @@
<outputDirectory>wso2mi-${pom.version}/repository/resources/conf</outputDirectory>
<excludes>
<exclude>**/carbon.xml.j2</exclude>
<exclude>**/config.toml.j2</exclude>
</excludes>
</fileSet>
<fileSet>
Expand Down Expand Up @@ -521,16 +522,6 @@
<fileMode>644</fileMode>
</file>

<!-- Diagnostic tool files -->
<!-- <file>-->
<!-- <source>-->
<!-- ../p2-profile/target/wso2carbon-core-${carbon.kernel.version}/lib/org.wso2.ciphertool-${cipher.tool.version}.jar-->
<!-- </source>-->
<!-- <outputDirectory>${pom.artifactId}-${pom.version}/wso2/lib</outputDirectory>-->
<!-- <fileMode>644</fileMode>-->
<!-- </file>-->


<file>
<source>src/conf/synapse-handlers.xml</source>
<outputDirectory>wso2mi-${pom.version}/conf</outputDirectory>
Expand Down Expand Up @@ -630,6 +621,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
63 changes: 61 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,65 @@
"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",
"server_name": "WSO2 Micro Integrator",
"server_version": "4.3.0"
},
"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
@@ -1,23 +1,50 @@
#
# 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 = "../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"

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"
Expand All @@ -29,88 +56,88 @@ 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 = "true"
threshold = "20"
retry_count = "2"
interval = "5"
action_executors = "ThreadDumper,MetricsSnapshot,ServerInfo"
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 = "true"
threshold = "30"
retry_count = "2"
interval = "5"
action_executors = "ThreadDumper,MetricsSnapshot,ServerInfo"

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 = "true"
enabled = "{{log_watcher.enabled}}"
interval = {{log_watcher.interval}}

# 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"
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 = "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"
output_directory = "{{zip_file_configuration.output_directory}}"
max_count = "{{zip_file_configuration.max_count}}"

# Error regex patterns and diagnosis

# Example
#[[log_pattern]]
#regex = "(.*)Timeout(.*)"
#executors = "MetricsSnapshot,Netstat,OpenFileFinder,ServerInfo"
#reload_time = "30"

{%for pattern in log_pattern.patterns %}
[[log_pattern]]
regex = "(.*)org.apache.synapse.transport.passthru(.*)"
executors = "MetricsSnapshot,Netstat,OpenFileFinder,ThreadDumper,ServerInfo"
reload_time = "30"
regex = "{{pattern.pattern.regex}}"
executors = "{{pattern.pattern.executors}}"
reload_time = "{{pattern.pattern.reload_time}}"

[[log_pattern]]
regex = "(.*)org.apache.synapse(.*)"
executors = "ServerInfo"
reload_time = "10"
{% 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 fa9bf90

Please sign in to comment.