Fix nginx monitoring and services panel alignment

- Add support for both proxied and static nginx sites
- Proxied sites show 'P' prefix and check backend URLs
- Static sites check external HTTPS URLs
- Fix services panel column alignment for main services
- Keep 10-second timeout for all site checks
This commit is contained in:
2025-10-20 14:56:26 +02:00
parent 11be496a26
commit 2ccfc4256a
2 changed files with 129 additions and 84 deletions

View File

@@ -739,9 +739,8 @@ impl SystemdCollector {
while i < lines.len() {
let line = lines[i].trim();
if line.starts_with("server") && line.contains("{") {
if let Some(proxy_url) = self.parse_server_block(&lines, &mut i) {
let site_name = proxy_url.replace("http://", "").replace("https://", "");
sites.push((site_name, proxy_url));
if let Some((server_name, proxy_url)) = self.parse_server_block(&lines, &mut i) {
sites.push((server_name, proxy_url));
}
}
i += 1;
@@ -752,7 +751,7 @@ impl SystemdCollector {
}
/// Parse a server block to extract the primary server_name
fn parse_server_block(&self, lines: &[&str], start_index: &mut usize) -> Option<String> {
fn parse_server_block(&self, lines: &[&str], start_index: &mut usize) -> Option<(String, String)> {
use tracing::debug;
let mut server_names = Vec::new();
let mut proxy_pass_url = None;
@@ -806,9 +805,15 @@ impl SystemdCollector {
*start_index = i - 1;
if let Some(proxy_url) = proxy_pass_url {
if !has_redirect {
return Some(proxy_url);
if !server_names.is_empty() && !has_redirect {
if let Some(proxy_url) = proxy_pass_url {
// Site with proxy_pass: check backend, show "P" prefix
let proxied_name = format!("P {}", server_names[0]);
return Some((proxied_name, proxy_url));
} else {
// Site without proxy_pass: check external HTTPS
let external_url = format!("https://{}", server_names[0]);
return Some((server_names[0].clone(), external_url));
}
}