Add info-level logging for VPN external IP debugging
All checks were successful
Build and Release / build-and-release (push) Successful in 1m10s
All checks were successful
Build and Release / build-and-release (push) Successful in 1m10s
Change debug to info/warn logging to diagnose VPN IP query issues. Use exact service name match instead of contains. Version: v0.1.235
This commit is contained in:
@@ -1,6 +1,6 @@
|
||||
[package]
|
||||
name = "cm-dashboard-agent"
|
||||
version = "0.1.234"
|
||||
version = "0.1.235"
|
||||
edition = "2021"
|
||||
|
||||
[dependencies]
|
||||
|
||||
@@ -159,16 +159,23 @@ impl SystemdCollector {
|
||||
}
|
||||
}
|
||||
|
||||
if service_name.contains("openvpn-vpn-connection") && status_info.active_state == "active" {
|
||||
if let Some(external_ip) = self.get_vpn_external_ip() {
|
||||
let metrics = Vec::new();
|
||||
if service_name == "openvpn-vpn-connection" && status_info.active_state == "active" {
|
||||
tracing::info!("Checking VPN external IP for service: {}", service_name);
|
||||
match self.get_vpn_external_ip() {
|
||||
Some(external_ip) => {
|
||||
tracing::info!("Got VPN external IP: {}", external_ip);
|
||||
let metrics = Vec::new();
|
||||
|
||||
sub_services.push(SubServiceData {
|
||||
name: format!("IP: {}", external_ip),
|
||||
service_status: Status::Ok,
|
||||
metrics,
|
||||
service_type: "vpn_route".to_string(),
|
||||
});
|
||||
sub_services.push(SubServiceData {
|
||||
name: format!("IP: {}", external_ip),
|
||||
service_status: Status::Ok,
|
||||
metrics,
|
||||
service_type: "vpn_route".to_string(),
|
||||
});
|
||||
}
|
||||
None => {
|
||||
tracing::warn!("Failed to get VPN external IP");
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -872,12 +879,12 @@ impl SystemdCollector {
|
||||
if output.status.success() {
|
||||
let ip = String::from_utf8_lossy(&output.stdout).trim().to_string();
|
||||
if !ip.is_empty() && ip.contains('.') {
|
||||
debug!("VPN external IP: {}", ip);
|
||||
return Some(ip);
|
||||
}
|
||||
}
|
||||
|
||||
debug!("Failed to get VPN external IP");
|
||||
let stderr = String::from_utf8_lossy(&output.stderr);
|
||||
tracing::warn!("VPN external IP query failed. Exit code: {:?}, stderr: {}", output.status.code(), stderr);
|
||||
None
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user