Skip to content

Implement container health alerts#1679

Open
Jdbarad wants to merge 4 commits intohenrygd:mainfrom
Jdbarad:feature/container-alerts
Open

Implement container health alerts#1679
Jdbarad wants to merge 4 commits intohenrygd:mainfrom
Jdbarad:feature/container-alerts

Conversation

@Jdbarad
Copy link
Copy Markdown

@Jdbarad Jdbarad commented Jan 25, 2026

Container Health Alerts & UI Overhaul [#716]

📃 Description

This PR introduces comprehensive support for container health alerts and significantly overhauls the Alerts UI. It adds backend logic to monitor container health status and a redesigned, searchable frontend interface for efficient alert management in environments with high container counts.

📖 Documentation

Add a link to the PR for documentation changes.

🪵 Changelog

➕ Added

  • Container Health Alerts: Backend logic to monitor and trigger alerts based on container health status.
  • Searchable Container List: A new UI section in the alerts sheet to quickly find and toggle alerts for specific containers.
  • Database Migration: A dedicated migration to convert the alerts collection name field to text, supporting dynamic container alert names.
  • Batch Actions: Added "All" and "None" buttons to quickly toggle alerts for all currently filtered containers.

✏️ Changed

  • Alerts UI Overhaul: Refined the layout of the Alerts sheet, removing excess padding and implementing a focused scroll area for the container list.
  • Stats Serialization: Exported Health and Status fields in container stats for frontend and alert system access.
  • Alert Logic: Updated the alert manager to handle container-specific thresholds and notification subjects.

🔧 Fixed

  • UI Consistency: Standardized container alerts to use the same toggle and slider components as system-level alerts.
  • Reliability: Improved container data fetching using useEffect to ensure the list stays in sync when switching between systems.

🗑️ Removed

  • Unused Code: Cleaned up various unused imports and state variables in the alerts components.

📷 Screenshots

localhost_8090_ (1)

@Jdbarad Jdbarad requested a review from henrygd as a code owner January 25, 2026 11:54
@Jdbarad Jdbarad changed the title Implement container health alerts Implement container health alerts [#716] Jan 25, 2026
@Jdbarad Jdbarad changed the title Implement container health alerts [#716] Implement container health alerts Jan 25, 2026
@albertorizzi
Copy link
Copy Markdown
Contributor

Is it possibile to set for every container the trigger of unhealthy instead to set for everyone?

@kaysond
Copy link
Copy Markdown

kaysond commented Jan 25, 2026

Is it possibile to set for every container the trigger of unhealthy instead to set for everyone?

Agree. The ux is not great IMO. The original issue had a much nicer mock up:
#716 (comment)

@Jdbarad
Copy link
Copy Markdown
Author

Jdbarad commented Jan 25, 2026

Is it possibile to set for every container the trigger of unhealthy instead to set for everyone?

Agree. The ux is not great IMO. The original issue had a much nicer mock up: #716 (comment)

Sure @kaysond

@Jdbarad
Copy link
Copy Markdown
Author

Jdbarad commented Jan 25, 2026

0 0 0 0_8090_ @albertorizzi @kaysond : Check this approach. If it's still not functional, then I can try some different approach.

@svenvg93
Copy link
Copy Markdown
Collaborator

Just my two cents on the UI;

  • Keep the All Containers in this sheet.
  • Move the settings per container to the Container Table on the System page. Same way as we have it for the System alerts, with a little bell opening a sheet with the alerts for that container. It will allow us later to add other alerts as CPU, Memory etc per container as well.

@Jdbarad
Copy link
Copy Markdown
Author

Jdbarad commented Jan 26, 2026

Just my two cents on the UI;

  • Keep the All Containers in this sheet.
  • Move the settings per container to the Container Table on the System page. Same way as we have it for the System alerts, with a little bell opening a sheet with the alerts for that container. It will allow us later to add other alerts as CPU, Memory etc per container as well.

Agreed. Keeping the sheet focused on 'All Containers' and shifting the specific alerts to the Container Table is a cleaner approach. I’ll rework the UI now and get back to you with a fresh, updated look.

@albertorizzi
Copy link
Copy Markdown
Contributor

Any news?

Copy link
Copy Markdown
Owner

@henrygd henrygd left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Sorry for lack of guidance, this is a fairly complex feature and I don't have enough time to go super in-depth right now.

All current alerts are based on systems. Rather than modifying the current alerts collection, it may be easier to create a new container_alerts collection. Likewise, it would probably be cleaner to make a separate alerts_container.go rather than mixing this in with alerts_system.go.

The functionality should work more like alerts_status.go anyway, since container health is a boolean state (unhealthy or not unhealthy), like system status (down or not down), rather than a value we need to average out and compare to a threshold like in alerts_system.go.

I'm also not completely satisfied with what I did in alerts_status.go, so it's not necessary to copy that pattern exactly. I'm sure there's a better way to do it.

We have access to all the container data on the hub side in system.go, so we can pass the data through to the alert functions somewhere around here:

// add containers and container_stats records
if len(data.Containers) > 0 {
if data.Containers[0].Id != "" {
if err := createContainerRecords(txApp, data.Containers, sys.Id); err != nil {
return err
}
}

IMO it would be best to make it a general "Container Health" alert that sends notifications when any containers on the system switch to / from unhealthy. We can add a way to exclude certain containers later, it doesn't need to be included in this PR. I'd rather keep the scope of this one as narrow as possible.

@Jdbarad
Copy link
Copy Markdown
Author

Jdbarad commented Jan 29, 2026

@henrygd Soon, I'll share the architecture change and UI in detail. In my mind also same thing is going on about container_alerts collection. Once all and you review i'll start working on that part.

@Jdbarad
Copy link
Copy Markdown
Author

Jdbarad commented Jan 31, 2026

Screenshot 2026-02-01 at 12 14 48 AM Screenshot 2026-02-01 at 12 14 21 AM Screenshot 2026-02-01 at 12 14 08 AM Screenshot 2026-02-01 at 12 13 50 AM Screenshot 2026-02-01 at 1 01 36 AM Screenshot 2026-02-01 at 1 03 38 AM

@henrygd @albertorizzi Check this UI screenshots

@albertorizzi
Copy link
Copy Markdown
Contributor

@Jdbarad I use Notifiche Webhook / Push with Telegram. Is this flow implemented?

@Jdbarad
Copy link
Copy Markdown
Author

Jdbarad commented Feb 3, 2026

@Jdbarad I use Notifiche Webhook / Push with Telegram. Is this flow implemented?

Yes, That flow also implemented

@Rubilmax
Copy link
Copy Markdown

Pls review this devs 🙏

@Jdbarad
Copy link
Copy Markdown
Author

Jdbarad commented Feb 12, 2026

@henrygd Can you please review this updated code.

@ddmunhoz
Copy link
Copy Markdown

I quickly reviewed it, everything seems to check. 🚀

@henrygd
Copy link
Copy Markdown
Owner

henrygd commented Mar 31, 2026

I should be able to get to it this week, or at least relatively soon. Don't worry about merge conflicts.

@Jdbarad
Copy link
Copy Markdown
Author

Jdbarad commented Apr 1, 2026

@henrygd Let me know if any help is needed.

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

Labels

None yet

Projects

Status: Next

Development

Successfully merging this pull request may close these issues.

7 participants