Poll Zabbix for toner levels on a schedule and email/webhook on a downward crossing. Warning fires at or below the warning threshold (default 5%), critical at the critical threshold (default 0%); both thresholds are settings. State lives in printersupplyalerts so an alert fires once per crossing and re-arms after a refill. Recipients mirror the printedparts pattern: plugin-scoped shopdb users + roles + free-text emails (falling back to the site alert_recipients), and a chosen support team's webhook (falling back to the site alert_webhook_url). - PrinterSupplyAlert model + migration printers0002supplyalerts - alerttier(remaining, warning, critical) + check_supplies poller - flask printers check-toner-alerts CLI (run via scheduled task/cron) - printers alert settings + Low-Toner Alerts settings page - 7 tests: tier boundaries, once-per-crossing + re-arm, toner-only scope, custom thresholds, support-team webhook routing
23 lines
546 B
Python
23 lines
546 B
Python
"""Printers plugin models."""
|
|
|
|
from .printer import Printer, PrinterType # Asset-based models
|
|
from .printer_driver import PrinterDriver
|
|
from .model_supply import ( # data-driven model -> toner/drum/waste mapping
|
|
ModelSupply,
|
|
SUPPLY_TYPES,
|
|
SUPPLY_COLORS,
|
|
CAPACITY_TIERS,
|
|
)
|
|
from .supply_alert import PrinterSupplyAlert # per-printer toner alert state
|
|
|
|
__all__ = [
|
|
'Printer',
|
|
'PrinterType',
|
|
'PrinterDriver',
|
|
'ModelSupply',
|
|
'PrinterSupplyAlert',
|
|
'SUPPLY_TYPES',
|
|
'SUPPLY_COLORS',
|
|
'CAPACITY_TIERS',
|
|
]
|