supervisord
This commit is contained in:
80
app.py
80
app.py
@@ -103,85 +103,7 @@ except Exception as e:
|
||||
def display_haproxy_stats():
|
||||
haproxy_stats = fetch_haproxy_stats()
|
||||
parsed_stats = parse_haproxy_stats(haproxy_stats)
|
||||
return render_template_string('''
|
||||
<style>
|
||||
/* Custom CSS for the header */
|
||||
header {
|
||||
background-color: #f2f2f2;
|
||||
padding: 20px;
|
||||
display: flex;
|
||||
padding-left: 100px;
|
||||
align-items: center;
|
||||
}
|
||||
|
||||
|
||||
.logo {
|
||||
width: 300px; /* Adjust the width as needed */
|
||||
height: auto;
|
||||
}
|
||||
|
||||
|
||||
.menu-link {
|
||||
text-decoration: none;
|
||||
padding: 10px 20px;
|
||||
color: #333;
|
||||
font-weight: bold;
|
||||
}
|
||||
|
||||
|
||||
.menu-link:hover {
|
||||
background-color: #3B444B;
|
||||
color: white;
|
||||
text-decoration: none;
|
||||
}
|
||||
</style>
|
||||
<header>
|
||||
<a href="/home" style="text-decoration: none;">
|
||||
<h3 style="color: grey; font-size: 22px;" class="logo">
|
||||
<i style="margin: 8px;" class="fas fa-globe"></i>Haproxy Configurator
|
||||
</h3>
|
||||
</a>
|
||||
<a href="/home" class="menu-link">Home</a>
|
||||
<a href="/" class="menu-link">Add Frontend&Backend</a>
|
||||
<a href="/edit" class="menu-link">Edit HAProxy Config</a>
|
||||
<a href="/logs" class="menu-link">Security Events</a>
|
||||
<a href="/statistics" class="menu-link">Statistics</a>
|
||||
<a href="http://{{ request.host.split(':')[0] }}:8080/stats" class="menu-link">HAProxy Stats</a>
|
||||
</header>
|
||||
<link href="https://cdn.jsdelivr.net/npm/bootstrap@5.3.0/dist/css/bootstrap.min.css" rel="stylesheet">
|
||||
<div class="container">
|
||||
<h1 class="my-4">HAProxy Stats</h1>
|
||||
<div class="table-responsive">
|
||||
<table class="table table-bordered table-striped">
|
||||
<thead>
|
||||
<tr>
|
||||
<th>Frontend Name</th>
|
||||
<th>Server Name</th>
|
||||
<th>4xx Errors</th>
|
||||
<th>5xx Errors</th>
|
||||
<th>Bytes In (MB)</th>
|
||||
<th>Bytes Out (MB)</th>
|
||||
<th>Total Connections</th>
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody>
|
||||
{% for stat in stats %}
|
||||
<tr>
|
||||
<td>{{ stat.frontend_name }}</td>
|
||||
<td>{{ stat.server_name }}</td>
|
||||
<td>{{ stat['4xx_errors'] }}</td>
|
||||
<td>{{ stat['5xx_errors'] }}</td>
|
||||
<td>{{ stat.bytes_in_mb }}</td>
|
||||
<td>{{ stat.bytes_out_mb }}</td>
|
||||
<td>{{ stat.conn_tot }}</td>
|
||||
</tr>
|
||||
{% endfor %}
|
||||
</tbody>
|
||||
</table>
|
||||
</div>
|
||||
</div>
|
||||
''', stats=parsed_stats)
|
||||
|
||||
return render_template('statistics.html', stats=parsed_stats)
|
||||
|
||||
# Logs Route
|
||||
@app.route('/logs')
|
||||
|
||||
Reference in New Issue
Block a user