MMOframework
Pourquoi l'IA Playground Bibliothèques Documentation Rechercher Agence
FR EN
Index

Rules

MMO\admin\monitoring · 1 symbole · générée le 27 Oct 2026

class

Rules

Rules.php:19

The thresholds a reading is judged by: a metric above its warning raises the reading to a warning, above its critical to critical -- below, for a rule that says below (days left on a certificate).

class MMO\admin\monitoring\Rules
Espace de noms
MMO\admin\monitoring
Voir
DEFAULTS are what a hub gets without saying anything. A hub's own rules (hub.json, rules) come first: a rule of its own for the same metric and probe replaces the default one, "off": true removes it, and subjects narrows a rule to some servers or targets -- the one client whose disk is meant to be full.
A metric is named by a glob (`fnmatch`): `disk.*.usedPercent` is every disk.
$rules = new Rules([['metric' => 'disk.*.usedPercent', 'warning' => 70, 'critical' => 85]]); $rules->apply($reading); // raises $reading's status, fills $reading->alerts

Index

DEFAULTSprobe => list of rules: what every hub watches unless it says otherwise
rules
all()
apply($reading)Judge a reading: raise its status, list what crossed a line in its alerts.
debugName()
format($value)
forProbe($probe)
judge($rule, $value)
matchesSubject($subject, $name, $subjects)
starred($glob, $metric)
__construct($rules)

Constantes1

DEFAULTS

probe => list of rules: what every hub watches unless it says otherwise

const DEFAULTS = […6 items]

Propriétés1

rules

protected array $rules = []
Type
array

Méthodes9

all()

Rules.php:81
function all(): array
retournearraylist<array<string, mixed>>> every rule, by probe

apply($reading)

Rules.php:88

Judge a reading: raise its status, list what crossed a line in its alerts.

function apply(MMO\admin\monitoring\Reading $reading): MMO\admin\monitoring\Reading
$readingReading
retourneReadingthe same

forProbe($probe)

Rules.php:78
function forProbe(string $probe): array
$probestring
retournearraymixed>> the rules judging $probe's readings

judge($rule, $value)

Rules.php:116
function judge(array $rule, float $value): ?string
$rulearray
$valuefloat
retournenull | stringthe level $value reaches under $rule, null for none

matchesSubject($subject, $name, $subjects)

Rules.php:127
protected function matchesSubject(string $subject, string $name, array $subjects): bool
$subjectstring
$namestring
$subjectsarraynames or globs, server:ovh* or a bare name
retournebool

starred($glob, $metric)

Rules.php:135
protected function starred(string $glob, string $metric): string
$globstring
$metricstring
retournestringwhat the * of $glob stands for in $metric: disk.*.usedPercent, disk.var-www.usedPercent is var-www

__construct($rules)

Rules.php:59
function __construct(array $rules = [])
$rules = []array