Skip to content

server: name the networks, IPs and failing checks in the router health check alert - #14879

Open
jmsperu wants to merge 1 commit into
apache:mainfrom
jmsperu:server-vr-health-alert-detail
Open

jmsperu wants to merge 1 commit into
apache:mainfrom
jmsperu:server-vr-health-alert-detail

Conversation

@jmsperu

@jmsperu jmsperu commented Nov 26, 2026

Copy link
Copy Markdown
Collaborator

Description

When router health checks fail, the alert only names the router:

Health checks failed: 1 failing checks on router r-4-VM / 9c16a992-e635-45e3-9728-282a61de0d20

To find out which network is affected and what is actually failing, an operator has to look up the router, its networks and its health check results by hand. With many routers this slows down the response to every alert.

This PR builds the alert from data CloudStack already has:

  • Subject (shown on the Alerts page): the guest network name(s) or the VPC name, the public IP and the names of the failing checks.
  • Body (sent in the alert email): zone, account, host, state (and redundant state, for redundant routers only), every NIC with its network name, UUID and IP, and the details of each failing check from router_health_check.

The subject and body are kept within the sizes of the alert.subject (999) and alert.content (5000) columns, and each check's details are trimmed to 1000 characters. If any lookup fails, the alert falls back to the existing text, so a health check alert is never lost.

Types of changes

  • Enhancement (improves an existing feature and functionality)

Feature/Enhancement Scale or Bug Severity

Feature/Enhancement Scale

  • Minor

How Has This Been Tested?

Unit tests in VirtualNetworkApplianceManagerImplTest: the subject and body for a router with guest, control and public NICs and a failing check with details, a body kept within 5000 characters when many checks report long details, and the fallback when a lookup throws. All 11 tests in the class pass.

Lab test on 4.22.1.1 (KVM, Ubuntu 24.04), with the change applied to the management server: on an isolated network router, dnsmasq was stopped and masked, then getRouterHealthCheckResults performfreshchecks=true was called.

Before:

Health checks failed: 1 failing checks on router r-4-VM / 9c16a992-e635-45e3-9728-282a61de0d20

After, subject:

Health checks failed on router r-4-VM (network testnet1, 192.168.200.12): dhcp.service

After, body:

1 failing health check(s) on router r-4-VM (9c16a992-e635-45e3-9728-282a61de0d20)

Zone: lab-zone
Account: admin
Host: lab-acs-kvm1
State: Running
Public IP: 192.168.200.12
Networks:
  Guest network testnet1 (c3f29c16-1fb0-43c6-a9b4-b011d6beb826): 10.1.1.1
  Control network (44f112f3-81ea-4c62-bd8e-0ad2a5b19022): 169.254.131.177
  Public network (5f756c34-3c6e-46a0-838d-eb8372b0ec79): 192.168.200.12

Failing checks:
  dhcp.service: service down at last check 1795715983

The "Checking failed health checks to see if router needs recreate" log line now carries the same subject. After the test dnsmasq was restored and the router went back to healthy.

…h check alert

The alert only gave the router name and UUID. The subject now carries the guest network(s) or VPC, the public IP and the failing check names; the body lists zone, account, host, state, every NIC with its network and IP, and the details of each failing check.

Signed-off-by: James Peru <jmsperu@gmail.com>
@codecov

codecov Bot commented Nov 26, 2026 •

Copy link
Copy Markdown

Codecov Report

❌ Patch coverage is 66.66667% with 22 lines in your changes missing coverage. Please review.
✅ Project coverage is 20.93%. Comparing base (caf1091) to head (68093ae).
⚠️ Report is 9 commits behind head on main.

Files with missing lines Patch % Lines
...ork/router/VirtualNetworkApplianceManagerImpl.java 66.66% 7 Missing and 15 partials ⚠️
Additional details and impacted files
@@             Coverage Diff              @@
##               main   #14879      +/-   ##
============================================
+ Coverage     20.80%   20.93%   +0.12%     
- Complexity    20925    21155     +230     
============================================
  Files          6053     6057       +4     
  Lines        548466   549621    +1155     
  Branches      73283    78262    +4979     
============================================
+ Hits         114129   115042     +913     
- Misses       420977   421115     +138     
- Partials      13360    13464     +104     
Flag Coverage Δ
uitests 3.86% <ø> (ø)
unittests 22.37% <66.66%> (+0.12%) ⬆️

Flags with carried forward coverage won't be shown. Click here to find out more.

☔ View full report in Codecov by Harness.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

This branch has not been deployed

No deployments
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant