Repository navigation
feat: live monitoring, minute averages and peaks, editable alert rules with email, log search - #24
Merged
Merged
Conversation
…le alert rules with email, and log search (#21) A stats stream per running container and /proc on the host feed a 1 second frame: CPU, memory, network and disk rates. GET /api/live streams it to every tab over Server-Sent Events with the last three minutes, and closes when the viewer stops being a member. History keeps each minute's average and peak, with network and disk, in the existing table. Charts gain a live range, network and disk, and a peak view. Alerts are checked every 10 seconds against rules owners edit (threshold, duration, on or off), open once a condition holds for its duration, resolve after a clear minute, and are emailed through SMTP_URL to ALERTS_EMAIL with a test button. Logs adds a search across containers.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Real-time monitoring, alerts and log search inside the console, instead of a Grafana, Prometheus and Loki stack: no new services, one sign-in behind Cloudflare Access, a few tens of MB.
This is #21's change on current
main. #21 was merged intofix/redeploy-images-accuracy(its base) instead ofmain, and #23 conflicts because that branch holds #20's original commit whilemainholds its squash. This branch ismainplus #21's one commit; its tree is identical to what #21 merged.Live data
stats?stream=falsecall per container every 5 seconds./proc: CPU, memory, swap, load, and network (physical interfaces of the host's namespace,/proc/1/net/dev) and disk (/proc/diskstats, whole disks) rates. Disk space every 30 seconds.GET /api/liveis Server-Sent Events: the last three minutes on connect, then a frame each second. It re-checks the viewer's membership every minute and closes when it is gone. OneEventSourceper tab, shared by every component.History
Each minute is now the average and peak of its seconds, with average network and disk rates, written to the existing
samplestable through added columns (cpu_peak,memory_peak,net,io). The 30 days already stored stay readable; their average stands in for the missing peak. Before, each minute stored one instantaneous 5-second sample.Alerts
alerts.db: host CPU, memory, swap and disk; a container's CPU and memory against its own limits (new); stopped, unhealthy and restarting containers; a project without a backup.ALERTS_EMAILthroughSMTP_URL(fromALERTS_FROM, orALERTS_EMAIL), with a Send a test email button for owners. GitHub issues continue whenALERTS_TOKENis set; one channel failing does not stop the other.Logs
A Logs page searches every container's logs, or one project's, over the last 15 minutes to 7 days, case-insensitively, newest first, up to 500 lines.
Dependency
nodemailer10.3.1 (approved), server only;@types/nodemailer8.0.2 for development.Settings
SMTP_URL(for examplesmtps://user:password@smtp.example.com:465),ALERTS_EMAIL,ALERTS_FROM, all optional, in the console's env file; platform passes them through (Project-Graphite/platform#45).Checks
tsc(server and web),oxlint,npm run build, andtest/alerts.spec.ts,test/live.spec.ts,test/host.spec.ts,test/history.spec.ts,test/backups.spec.ts,test/inventory.spec.ts,test/docker.spec.ts,test/secrets.spec.ts,test/access.spec.ts,test/terminal.spec.ts. Not run: the stats streams and/procreaders against a real Docker host, the live stream through Cloudflare, an email send, and the pages in a browser.