Revert nginx monitoring to check all sites via public HTTPS URLs

- Remove proxy_pass backend checking
- All sites now checked using https://server_name format
- Maintains 10-second timeout for external site checks
- Simplifies monitoring to consistent external health checks
This commit is contained in:
Christoffer Martinsson 2025-10-20 15:06:42 +02:00
parent 2ccfc4256a
commit e998679901

View File

@ -739,8 +739,9 @@ impl SystemdCollector {
while i < lines.len() { while i < lines.len() {
let line = lines[i].trim(); let line = lines[i].trim();
if line.starts_with("server") && line.contains("{") { if line.starts_with("server") && line.contains("{") {
if let Some((server_name, proxy_url)) = self.parse_server_block(&lines, &mut i) { if let Some(server_name) = self.parse_server_block(&lines, &mut i) {
sites.push((server_name, proxy_url)); let url = format!("https://{}", server_name);
sites.push((server_name.clone(), url));
} }
} }
i += 1; i += 1;
@ -751,7 +752,7 @@ impl SystemdCollector {
} }
/// Parse a server block to extract the primary server_name /// Parse a server block to extract the primary server_name
fn parse_server_block(&self, lines: &[&str], start_index: &mut usize) -> Option<(String, String)> { fn parse_server_block(&self, lines: &[&str], start_index: &mut usize) -> Option<String> {
use tracing::debug; use tracing::debug;
let mut server_names = Vec::new(); let mut server_names = Vec::new();
let mut proxy_pass_url = None; let mut proxy_pass_url = None;
@ -806,15 +807,7 @@ impl SystemdCollector {
*start_index = i - 1; *start_index = i - 1;
if !server_names.is_empty() && !has_redirect { if !server_names.is_empty() && !has_redirect {
if let Some(proxy_url) = proxy_pass_url { return Some(server_names[0].clone());
// 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));
}
} }
None None