Initial commit
This commit is contained in:
7
skills/load-balancer-tester/assets/README.md
Normal file
7
skills/load-balancer-tester/assets/README.md
Normal file
@@ -0,0 +1,7 @@
|
||||
# Assets
|
||||
|
||||
Bundled resources for load-balancer-tester skill
|
||||
|
||||
- [ ] test_template.json: JSON template for defining load balancer test configurations.
|
||||
- [ ] report_template.html: HTML template for generating load balancer test reports.
|
||||
- [ ] example_config.conf: Example load balancer configuration file.
|
||||
74
skills/load-balancer-tester/assets/example_config.conf
Normal file
74
skills/load-balancer-tester/assets/example_config.conf
Normal file
@@ -0,0 +1,74 @@
|
||||
# Example Load Balancer Configuration File
|
||||
# This file provides a template for configuring the load balancer settings
|
||||
# to be used with the load-balancer-tester plugin.
|
||||
|
||||
# --- General Configuration ---
|
||||
# Name of the load balancer (used for identification)
|
||||
load_balancer_name = "my-load-balancer"
|
||||
|
||||
# Load balancing strategy:
|
||||
# Options: round-robin, weighted-round-robin, least-connections, ip-hash
|
||||
load_balancing_strategy = "round-robin"
|
||||
|
||||
# --- Backend Server Configuration ---
|
||||
# List of backend servers with their respective weights (if applicable)
|
||||
# Format: "server_address:port:weight"
|
||||
# Example: "192.168.1.10:8080:10", "192.168.1.11:8080:20", "192.168.1.12:8080" (default weight is 1)
|
||||
backend_servers = [
|
||||
"server1.example.com:80:1",
|
||||
"server2.example.com:80:1",
|
||||
"server3.example.com:80:1"
|
||||
]
|
||||
|
||||
# --- Health Check Configuration ---
|
||||
# Health check endpoint for backend servers
|
||||
health_check_endpoint = "/health"
|
||||
|
||||
# Health check interval (in seconds)
|
||||
health_check_interval = 5
|
||||
|
||||
# Health check timeout (in seconds)
|
||||
health_check_timeout = 2
|
||||
|
||||
# Number of consecutive successful health checks required to mark a server as healthy
|
||||
healthy_threshold = 3
|
||||
|
||||
# Number of consecutive failed health checks required to mark a server as unhealthy
|
||||
unhealthy_threshold = 3
|
||||
|
||||
# --- Session Persistence (Sticky Sessions) Configuration ---
|
||||
# Enable or disable sticky sessions
|
||||
sticky_sessions_enabled = false
|
||||
|
||||
# Cookie name for session persistence (if sticky sessions are enabled)
|
||||
sticky_session_cookie_name = "LB_SESSION"
|
||||
|
||||
# --- Failover Configuration ---
|
||||
# Time to wait before considering a server as failed (in seconds)
|
||||
failover_timeout = 10
|
||||
|
||||
# --- Traffic Distribution Validation ---
|
||||
# Number of requests to send for traffic distribution validation
|
||||
number_of_requests = 1000
|
||||
|
||||
# --- Advanced Configuration (Optional) ---
|
||||
# Custom headers to be added to the requests
|
||||
# Format: "header_name:header_value"
|
||||
# Example: "X-Custom-Header:MyValue"
|
||||
custom_headers = [
|
||||
# "X-Request-ID: $RANDOM_UUID" # Example - replace with your desired logic
|
||||
]
|
||||
|
||||
# Request method to use for testing (GET, POST, PUT, DELETE, etc.)
|
||||
request_method = "GET"
|
||||
|
||||
# URL path to request. Defaults to "/" if not provided.
|
||||
request_path = "/"
|
||||
|
||||
# --- Notes ---
|
||||
# - Replace the placeholder values with your actual load balancer configuration.
|
||||
# - Ensure that the backend servers are accessible from the machine running the plugin.
|
||||
# - Adjust the health check parameters based on your application's health check requirements.
|
||||
# - For weighted round-robin, ensure that the weights are integers.
|
||||
# - Remember to save this file with a `.conf` extension (e.g., `my_load_balancer.conf`).
|
||||
# - The plugin will read this file to configure the load balancer testing.
|
||||
204
skills/load-balancer-tester/assets/report_template.html
Normal file
204
skills/load-balancer-tester/assets/report_template.html
Normal file
@@ -0,0 +1,204 @@
|
||||
<!DOCTYPE html>
|
||||
<html lang="en">
|
||||
<head>
|
||||
<meta charset="UTF-8">
|
||||
<meta name="viewport" content="width=device-width, initial-scale=1.0">
|
||||
<title>Load Balancer Test Report</title>
|
||||
<style>
|
||||
/* Basic CSS Reset */
|
||||
body, h1, h2, h3, p, ul, li {
|
||||
margin: 0;
|
||||
padding: 0;
|
||||
border: 0;
|
||||
font-size: 100%;
|
||||
font: inherit;
|
||||
vertical-align: baseline;
|
||||
}
|
||||
|
||||
body {
|
||||
font-family: sans-serif;
|
||||
line-height: 1.6;
|
||||
background-color: #f4f4f4;
|
||||
color: #333;
|
||||
padding: 20px;
|
||||
}
|
||||
|
||||
.container {
|
||||
max-width: 800px;
|
||||
margin: 0 auto;
|
||||
background-color: #fff;
|
||||
padding: 20px;
|
||||
border-radius: 8px;
|
||||
box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
|
||||
}
|
||||
|
||||
h1 {
|
||||
font-size: 2em;
|
||||
margin-bottom: 20px;
|
||||
text-align: center;
|
||||
color: #007bff; /* Primary color */
|
||||
}
|
||||
|
||||
h2 {
|
||||
font-size: 1.5em;
|
||||
margin-bottom: 10px;
|
||||
color: #007bff;
|
||||
}
|
||||
|
||||
h3 {
|
||||
font-size: 1.2em;
|
||||
margin-bottom: 5px;
|
||||
color: #555;
|
||||
}
|
||||
|
||||
p {
|
||||
margin-bottom: 15px;
|
||||
}
|
||||
|
||||
ul {
|
||||
list-style-type: disc;
|
||||
margin-left: 20px;
|
||||
margin-bottom: 15px;
|
||||
}
|
||||
|
||||
li {
|
||||
margin-bottom: 5px;
|
||||
}
|
||||
|
||||
.status-good {
|
||||
color: green;
|
||||
}
|
||||
|
||||
.status-bad {
|
||||
color: red;
|
||||
}
|
||||
|
||||
.status-warning {
|
||||
color: orange;
|
||||
}
|
||||
|
||||
.section {
|
||||
margin-bottom: 30px;
|
||||
border-bottom: 1px solid #eee;
|
||||
padding-bottom: 20px;
|
||||
}
|
||||
|
||||
.section:last-child {
|
||||
border-bottom: none;
|
||||
padding-bottom: 0;
|
||||
}
|
||||
|
||||
.table {
|
||||
width: 100%;
|
||||
border-collapse: collapse;
|
||||
margin-bottom: 20px;
|
||||
}
|
||||
|
||||
.table th, .table td {
|
||||
border: 1px solid #ddd;
|
||||
padding: 8px;
|
||||
text-align: left;
|
||||
}
|
||||
|
||||
.table th {
|
||||
background-color: #f2f2f2;
|
||||
}
|
||||
|
||||
/* Responsive Design */
|
||||
@media (max-width: 600px) {
|
||||
.container {
|
||||
padding: 10px;
|
||||
}
|
||||
|
||||
h1 {
|
||||
font-size: 1.8em;
|
||||
}
|
||||
|
||||
h2 {
|
||||
font-size: 1.3em;
|
||||
}
|
||||
}
|
||||
</style>
|
||||
</head>
|
||||
<body>
|
||||
<div class="container">
|
||||
<h1>Load Balancer Test Report</h1>
|
||||
|
||||
<div class="section">
|
||||
<h2>Test Summary</h2>
|
||||
<p><strong>Test ID:</strong> {{test_id}}</p>
|
||||
<p><strong>Date:</strong> {{test_date}}</p>
|
||||
<p><strong>Load Balancer URL:</strong> {{load_balancer_url}}</p>
|
||||
<p><strong>Overall Status:</strong> <span class="{{overall_status_class}}">{{overall_status}}</span></p>
|
||||
</div>
|
||||
|
||||
<div class="section">
|
||||
<h2>Traffic Distribution Validation</h2>
|
||||
<h3>Expected Distribution:</h3>
|
||||
<p>{{expected_distribution}}</p>
|
||||
<h3>Actual Distribution:</h3>
|
||||
<p>{{actual_distribution}}</p>
|
||||
<h3>Distribution Status: <span class="{{distribution_status_class}}">{{distribution_status}}</span></h3>
|
||||
<p>{{distribution_details}}</p>
|
||||
</div>
|
||||
|
||||
<div class="section">
|
||||
<h2>Failover Testing</h2>
|
||||
<h3>Failover Status: <span class="{{failover_status_class}}">{{failover_status}}</span></h3>
|
||||
<p>{{failover_details}}</p>
|
||||
<table class="table">
|
||||
<thead>
|
||||
<tr>
|
||||
<th>Instance</th>
|
||||
<th>Status Before Failover</th>
|
||||
<th>Status After Failover</th>
|
||||
<th>Response Time (ms)</th>
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody>
|
||||
{{failover_table_rows}}
|
||||
</tbody>
|
||||
</table>
|
||||
</div>
|
||||
|
||||
<div class="section">
|
||||
<h2>Sticky Session Verification</h2>
|
||||
<h3>Sticky Session Status: <span class="{{sticky_session_status_class}}">{{sticky_session_status}}</span></h3>
|
||||
<p>{{sticky_session_details}}</p>
|
||||
</div>
|
||||
|
||||
<div class="section">
|
||||
<h2>Health Check Testing</h2>
|
||||
<h3>Health Check Status: <span class="{{health_check_status_class}}">{{health_check_status}}</span></h3>
|
||||
<p>{{health_check_details}}</p>
|
||||
<table class="table">
|
||||
<thead>
|
||||
<tr>
|
||||
<th>Instance</th>
|
||||
<th>Health Check Endpoint</th>
|
||||
<th>Status Code</th>
|
||||
<th>Response Time (ms)</th>
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody>
|
||||
{{health_check_table_rows}}
|
||||
</tbody>
|
||||
</table>
|
||||
</div>
|
||||
|
||||
<div class="section">
|
||||
<h2>Detailed Logs</h2>
|
||||
<p>{{detailed_logs}}</p>
|
||||
</div>
|
||||
|
||||
<div class="section">
|
||||
<h2>Recommendations</h2>
|
||||
<p>{{recommendations}}</p>
|
||||
</div>
|
||||
|
||||
<footer>
|
||||
<p style="text-align: center; font-size: 0.8em; color: #777;">Report generated by Load Balancer Tester</p>
|
||||
</footer>
|
||||
</div>
|
||||
</body>
|
||||
</html>
|
||||
62
skills/load-balancer-tester/assets/test_template.json
Normal file
62
skills/load-balancer-tester/assets/test_template.json
Normal file
@@ -0,0 +1,62 @@
|
||||
{
|
||||
"_comment": "Load Balancer Test Configuration Template",
|
||||
"test_name": "Example Load Balancer Test",
|
||||
"description": "Tests traffic distribution and failover capabilities of the load balancer.",
|
||||
"target_url": "http://your-load-balancer-url.com",
|
||||
"num_requests": 1000,
|
||||
"concurrency": 10,
|
||||
"request_type": "GET",
|
||||
"request_headers": {
|
||||
"_comment": "Optional headers to include in each request",
|
||||
"Content-Type": "application/json",
|
||||
"X-Test-Header": "lb-tester"
|
||||
},
|
||||
"request_body": null,
|
||||
"distribution_validation": {
|
||||
"_comment": "Configuration for validating traffic distribution across backend servers",
|
||||
"enabled": true,
|
||||
"server_count": 3,
|
||||
"expected_distribution_tolerance": 0.1,
|
||||
"distribution_method": "request_count",
|
||||
"server_identifiers": [
|
||||
"server1",
|
||||
"server2",
|
||||
"server3"
|
||||
],
|
||||
"identifier_extraction_method": "header",
|
||||
"identifier_extraction_header": "X-Server-ID"
|
||||
},
|
||||
"failover_testing": {
|
||||
"_comment": "Configuration for testing failover capabilities",
|
||||
"enabled": true,
|
||||
"server_to_fail": "server2",
|
||||
"failover_wait_time": 10,
|
||||
"requests_after_failover": 200
|
||||
},
|
||||
"sticky_session_verification": {
|
||||
"_comment": "Configuration for verifying sticky sessions",
|
||||
"enabled": false,
|
||||
"session_cookie_name": "JSESSIONID",
|
||||
"requests_per_session": 10
|
||||
},
|
||||
"health_check_testing": {
|
||||
"_comment": "Configuration for testing health check behavior",
|
||||
"enabled": false,
|
||||
"health_check_endpoint": "/health",
|
||||
"expected_status_code": 200,
|
||||
"interval": 5,
|
||||
"duration": 60
|
||||
},
|
||||
"assertions": {
|
||||
"_comment": "Custom assertions to validate the response",
|
||||
"response_time_max": 200,
|
||||
"status_code_min": 200,
|
||||
"status_code_max": 299,
|
||||
"response_contains": null
|
||||
},
|
||||
"reporting": {
|
||||
"_comment": "Reporting configuration",
|
||||
"report_format": "json",
|
||||
"output_file": "lb_test_report.json"
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user