Zum Inhalt springen

Databases and their backups

Dieser Inhalt ist noch nicht in deiner Sprache verfügbar.

The agent finds the database engines installed on its machine and checks that they are backed up. It does this without credentials: it never connects to a database, never runs a SQL query and never reads a secret. It only looks at installed services, listening ports, a few registry keys and the folders where your backups land.

The databases appear as a Databases service under the machine, with one line per database, for example Running · last backup 3 h ago or Stopped · No recent backup. The state is always written, never colour alone.

EngineLinuxWindows
PostgreSQLpostgresql@16-main, postgresql-16 unitspostgresql-x64-16 and similar services
MySQL / MariaDBmysql, mysqld, mariadb unitsMySQL80, MySQL57, MariaDB services
Microsoft SQL Servermssql-server unitMSSQLSERVER, MSSQL$INSTANCE, SQLEXPRESS: every edition, named instances included
HFSQL (PC SOFT: WinDev, WebDev, WinDev Mobile)any unit named like HFSQLHFSQL Control Center service (default port 4900)
MongoDBmongod unitMongoDB service

For each database the agent reports the engine, the instance, the version when it can be read without credentials (SQL Server: registry; PostgreSQL and MySQL: the service name; PostgreSQL on Linux: the installed binaries), whether the service is running, and the port. A default port that answers with no matching service (a database in a container, for instance) is reported too.

The side services of an engine (SQL Server Agent, SQL Browser, MySQL Router, exporters) are ignored.

For each database the agent looks for the newest file or folder matching a list of paths and reports its date, its size and its age. It sets dumbmonit_agent_database_backup_overdue to 1 when that age exceeds the maximum age (36 hours by default) or when nothing matches a path you declared.

EngineDefault paths
SQL Serverthe instance’s default backup folder read from the registry (*.bak, *.trn); on Linux /var/opt/mssql/data
PostgreSQL (Linux)/var/backups/postgresql/*, pgBackRest (/var/lib/pgbackrest/backup/*/backup.info), Barman (/var/lib/barman/*/base/*/backup.info)
MySQL / MariaDB (Linux)/var/backups/mysql/*, /var/backups/mariadb/*, /var/backups/*.sql.gz
MongoDB (Linux)/var/backups/mongodb/*
HFSQLBackup, Backups and Sauvegarde next to the HFSQL server executable

If none of these contains anything, the database is shown with backup folder not found and no alert is raised: the agent cannot know that backups are missing when it does not know where to look. Declare the folder to turn the check on.

In agent.yaml:

databases:
backups:
sqlserver:
paths:
- 'D:\Backups\SQL\*.bak'
- 'D:\Backups\SQL\*.trn'
max_age_hours: 26
postgresql:
paths: ['/srv/backups/pg/*.dump']
mysql: # also accepts "mariadb"
paths: ['/srv/backups/*.sql.gz']
hfsql:
paths: ['E:\HFSQL\Sauvegardes\*']
  • Engine keys: postgresql, mysql (or mariadb), sqlserver, hfsql, mongodb. A rule applies to every instance of its engine.
  • paths: files or folders. * and ? work in every segment of the path (D:\Backups\*\*.bak). Quote Windows paths with single quotes.
  • max_age_hours: default 36. With several rules for one engine, the smallest age applies.
  • Declared paths replace the default ones for that engine. When nothing matches them, the backup counts as overdue.
  • databases.enabled: false (or DUMBMONIT_AGENT_DATABASES=false) turns the module off; databases.interval_secs (default 300, minimum 60) sets the reading period.

The module can also be unticked from the machine page, like the other agent services.

All series carry the labels engine and instance (the server adds target).

MetricMeaning
dumbmonit_agent_database_up1 if the service runs or its port answers, 0 if stopped
dumbmonit_agent_database_portPort in use, when known
dumbmonit_agent_database_infoAlways 1; the version label holds the version
dumbmonit_agent_database_backup_overdue1 when the newest backup is older than the maximum age
dumbmonit_agent_database_backup_age_secondsAge of the newest backup
dumbmonit_agent_database_backup_last_timestamp_secondsDate of the newest backup (Unix time)
dumbmonit_agent_database_backup_size_bytesSize of the newest backup file
dumbmonit_agent_database_backup_max_age_secondsMaximum age in force

Two built-in alert rules read them: Database backup overdue (the overdue verdict held for an hour) and Database service stopped (10 minutes).

The check proves that a recent backup file exists, not that it can be restored. Querying the database itself (msdb.dbo.backupset for SQL Server, pg_stat_archiver for PostgreSQL) needs credentials and is not done yet.