jmsperu opened a new pull request, #14879:
URL: https://github.com/apache/cloudstack/pull/14879

   ### 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
   
   - [x] Enhancement (improves an existing feature and functionality)
   
   ### Feature/Enhancement Scale or Bug Severity
   
   #### Feature/Enhancement Scale
   
   - [x] 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.
   


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]

Reply via email to