Ana içeriğe geç

📦 Database Schema

Monitron SaaS uses 14 migration files creating 20+ tables. Here's the complete schema reference.


📊 Core Tables

users

ColumnTypeDescription
idbigint PK
namestringDisplay name
emailstring (unique)Login email
passwordstringHashed password
avatar_urlstring (nullable)Profile picture URL
timezonestringUser's timezone
localestringLanguage preference
two_factor_secrettext (nullable)2FA secret
is_adminbooleanSuper admin flag
current_team_idFK → teamsActive team

teams

ColumnTypeDescription
idbigint PK
namestringTeam name
slugstring (unique)URL-friendly identifier
owner_idFK → usersTeam owner
settingsjson (nullable)Team-specific settings

team_user (pivot)

ColumnType
team_idFK → teams
user_idFK → users
rolestring (owner/admin/member)

📡 Monitoring Tables

monitors

ColumnTypeDescription
idbigint PK
team_idFK → teamsOwning team
namestringDisplay name
typestring (enum)Monitor type
addressstringURL, hostname, or IP
portint (nullable)Port number
interval_secondsintCheck frequency
timeout_secondsintMax wait time
configjson (nullable)Type-specific configuration
is_activebooleanActive flag
is_pausedbooleanManually paused
statusstring (enum)Current status
last_response_time_msint (nullable)Latest response time
last_checked_atdatetime (nullable)Last check timestamp
last_up_at / last_down_atdatetime (nullable)Last status change
consecutive_failuresintFailure counter
uptime_percentagedecimal(7,3)30-day uptime
heartbeat_tokenstring (nullable)Unique heartbeat URL token
tagsjson (nullable)Categorization tags
notestext (nullable)User notes

monitor_checks

High-volume table — stores every check result:

ColumnTypeDescription
idbigint PK
monitor_idFK → monitors
statusstringCheck result status
response_time_msint (nullable)Response time
status_codeint (nullable)HTTP status code
error_messagetext (nullable)Error details
metadatajson (nullable)Extra data (headers, cert info, etc.)
checked_atdatetimeWhen the check ran

Indexes: (monitor_id, checked_at) for fast time-range queries.


🔥 Incident Tables

incidents

ColumnTypeDescription
idbigint PK
team_idFK → teams
monitor_idFK → monitors (nullable)Related monitor
titlestringIncident title
severitystring (enum)Info/Warning/Critical/Emergency
statusstring (enum)Investigating/Identified/Monitoring/Resolved
descriptiontext (nullable)Details
started_atdatetimeWhen it started
acknowledged_atdatetime (nullable)When acknowledged
acknowledged_byFK → users (nullable)Who acknowledged
resolved_atdatetime (nullable)When resolved
resolved_byFK → users (nullable)Who resolved

incident_updates

Timeline entries for incidents.


🔔 Notification Tables

alert_rules, contacts, contact_groups, notification_logs

Alert routing, contact management, and delivery logging.


📊 Other Tables

status_pages, status_page_components, status_page_subscribers

Public status page configuration and subscribers.

server_agents, server_metrics

Server monitoring agent data.

certificates, domains

SSL certificate and domain WHOIS data.

maintenance_windows, audit_logs, app_settings

Scheduled maintenance, audit trail, and dynamic configuration.