Skip to content

ch14: add Housekeeping and the events tables chapter - #402

Open
WMP wants to merge 1 commit into
penmasters:mainfrom
WMP:docs/housekeeping-events-tables
Open

ch14: add Housekeeping and the events tables chapter#402
WMP wants to merge 1 commit into
penmasters:mainfrom
WMP:docs/housekeeping-events-tables

Conversation

@WMP

@WMP WMP commented Jun 11, 2026

Copy link
Copy Markdown

Summary

Adds a new expert-level page "Housekeeping and the events tables" to
Chapter 14 (ch14-zabbix-maintenance/housekeeper-events-tables.md) and wires it
into the navigation.

The existing Internal health page covers the housekeeper at a high level
(deleted-object cleanup). This page goes deep on the events/event_tag tables
themselves — what fills them, how they are cleaned, how to monitor them, and what
to do when the housekeeper can no longer keep up. None of event_tag,
pg_repack, maintenance_work_mem, CHECK_NOT_SUPPORTED or the per-source
event breakdown currently appear anywhere in the book.

What it adds

  • The event types — the source values (trigger / network discovery /
    autoregistration / internal / service) and the object refinement; which
    source tends to explode (internal) and why.
  • The events tablesevents, event_tag (usually the largest table),
    event_recovery, problem/problem_tag, and the ON DELETE CASCADE
    relationship (plus the non-cascading cause_eventid).
  • How the housekeeper cleans events — per-source retention under
    Administration → Housekeeping, HousekeepingFrequency,
    MaxHousekeeperDelete, and how to read the server log to see it fall behind.
  • Frontend impact — a bloated events table slows Monitoring → Problems,
    history/Item value widgets, and keeps autovacuum busy.
  • A low-cost SQL check to monitor table sizes and per-source row counts from
    Zabbix itself, using catalog sizes and planner estimates (reltuples,
    pg_stats MCV) instead of expensive count(*) scans, wired via the agent 2
    PostgreSQL plugin.
  • A safe batched purge procedure for internal events when the backlog is
    beyond the housekeeper (LIMIT + commit per batch, clear cause_eventid first,
    let the cascade remove children, watch replication).
  • Reclaiming disk afterwardspg_repack vs VACUUM FULL, raising
    autovacuum_work_mem to avoid repeated index passes, and the cosmetic
    "oldest XID" alert from a long-running vacuum.
  • The upstream fix — stop generating internal events (LLD filters and
    Check for not supported value, cross-linked to Chapter 4) and the fact that
    trigger dependencies do not write an event row at all, unlike maintenance
    suppression which still writes the event and merely hides it.

Why

Large environments routinely hit events-table bloat after a single template
starts generating internal events at scale. The symptoms (slow Problems page,
history widgets timing out, autovacuum/OOM) are rarely connected back to the
events tables. This page gives operators the model, the monitoring, and the
remediation in one place.

Notes

  • New file + one nav line in mkdocs.yml. Style follows book conventions
    (meta description + tags: [expert], admonitions, ~80-column prose).
  • PostgreSQL-oriented for the DB-level parts (sizes, purge, repack); the Zabbix
    concepts (event types, housekeeping, dependencies) are database-agnostic.

Sources

…ge, monitoring)

New expert-level page covering what the four-five event sources are, the
events/event_tag/event_recovery/problem tables and their cascade relationship,
how the housekeeper deletes events per source and how to spot it falling behind,
why a bloated events table slows the Problems page and history widgets, a
low-cost SQL check to monitor table sizes from Zabbix, a safe batched procedure
to purge internal events, reclaiming disk afterwards (pg_repack, autovacuum_work_mem),
and the upstream fixes (LLD filters, Check for not supported, trigger dependencies
not writing event rows vs maintenance which does). Added to nav.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
@larcorba larcorba self-assigned this Jun 13, 2026
@larcorba

Copy link
Copy Markdown
Collaborator

Hi @WMP

Thank you for contributing, we appreciate it. The parts look promising, but are missing some images. Could you add some screenshots to make it more visible to the reader what you are doing in Zabbix to make your parts work?

Furthermore, if you'd like these parts to be merged into the book we are going to need a signing deed of transfer. Can I send the file to the email address listed on your public profile?

Kind regards,

Nathan

@WMP

WMP commented Jun 13, 2026

Copy link
Copy Markdown
Author

Regarding the screenshots - I’ll see what I can do; I can upload some screenshots from Postgres and screenshots of the check creation process.

Yes, you can send an email - but watch out for a small typo in the domain address; it’s a special security measure against bots.

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.

3 participants