MMOframework
Why AI Playground Libraries Documentation Search Agency
FR EN
Index

DatabaseProbe

MMO\admin\monitoring\probes · 1 symbol · generated 27 Oct 2026

class

DatabaseProbe

DatabaseProbe.php:24

A target's database, asked on its server with the database's own client: its size, its collections (or tables), the connections, the server's uptime and version, the operations running for too long -- mongosh for MongoDB, mysql for MySQL / MariaDB.

class MMO\admin\monitoring\probes\DatabaseProbe extends MMO\admin\monitoring\aProbe
Namespace
MMO\admin\monitoring\probes
Extends
aProbe
Only targets with a `database` (deploy.json) are asked. How to reach it is [`$uri`](https://mmoframework.fr/en/documentation/mmo.admin/php/monitoring/probes/DatabaseProbe.md#databaseprobe-uri): `mongodb://127.0.0.1:27017` by default, a target's own `databaseUri` in the hub's credentials file when it needs a user and a password (`hub.credentials.json`, never `hub.json`). MySQL reads its user from the server's `~/.my.cnf`, as `mysqldump` does for mmo.admin's backups. Cumulative numbers (operations, queries since the server started) are counters: the hub makes them per second. Metrics: `db.dataMb`, `db.storageMb`, `db.indexMb`, `db.objects`, `db.collections`, `db.connections.current`, `db.connections.usedPercent`, `db.uptimeDays`, `db.slowOps`, and the rates `db.opsPerSec` / `db.queriesPerSec`, `db.slowQueriesPerSec`. Facts: `engine`, `database`, `dbVersion`. Details: `collections` (the largest, with their counts and sizes).

Constants5

DESCRIPTION

const DESCRIPTION = 'size, collections, connections, slow operations'

KIND

const KIND = 'target'

MONGODB

const MONGODB = 'mongodb'

MYSQL

const MYSQL = 'mysql'

NAME

const NAME = 'database'

Properties5

engine

string $engine = 'mongodb'
Type
string

slowSeconds

int $slowSeconds = 5
Type
int

top

int $top = 15
Type
int

uri

string $uri = 'mongodb://127.0.0.1:27017'
Type
string

Methods7

parseMongo($output, $reading)

DatabaseProbe.php:96
function parseMongo(string $output, MMO\admin\monitoring\Reading $reading): void
$outputstringwhat mongosh printed: a @@json line, then the JSON
$readingReadingfilled
returnsvoid

parseMysql($output, $reading)

DatabaseProbe.php:128
function parseMysql(string $output, MMO\admin\monitoring\Reading $reading): void
$outputstringwhat mysql --batch printed, sections marked by SELECT '@@name'
$readingReadingfilled
returnsvoid

probe($subject, $reading, $previous)

DatabaseProbe.php:57
protected function probe( MMO\admin\entities\Server|MMO\admin\entities\Target $subject, MMO\admin\monitoring\Reading $reading, ?MMO\admin\monitoring\Reading $previous ): void
$subjectServer | Target
$readingReading
$previousnull | Reading
returnsvoid
Inherited members (14)
ConstantsDeclared byDescription
SERVERaProbea probe of servers
TARGETaProbea probe of targets: the sites of the project, one per client
PropertiesDeclared byDescription
enabledaProbe
hubaProbe
timeoutaProbe
MethodsDeclared byDescription
collect($subject, $previous, $time)aProbeLook at a subject, never throwing: whatever goes wrong is in the reading.
debugName()aProbe
needsShell()aProbe
Number($value)aProbe
Percent($part, $whole)aProbe
run($subject, $script)aProbeRun a script on the subject, stopped after $timeout seconds where timeout exists (a webspace may lack it).
Sections($output)aProbe
shell($subject)aProbe
__construct($options, $hub)aProbe