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

Reading

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

class

Reading

Reading.php:23

What one probe saw of one subject (a server, a target), once: a status, numbers, facts and details.

class MMO\admin\monitoring\Reading implements JsonSerializable
Espace de noms
MMO\admin\monitoring
Implémente
JsonSerializable
Voir
Rules judge and what a chart draws. Anything that is not a number is a fact. - facts are short strings worth showing beside them (os, php, release), kept with the latest reading only. - details are whatever a page needs to explain the reading (the disks, the top processes, the last log lines), kept with the latest reading only. - counters are cumulative numbers (requests served since boot, bytes read in a log): the hub turns two consecutive ones into a rate (Hub::rates), as a single one means nothing.
- `metrics` are numbers only, named with dots (`disk.root.usedPercent`): they are what the time series keep, what A reading's status only gets worse while it is built: a probe sets what it saw, [`Rules`](https://mmoframework.fr/documentation/mmo.admin/php/monitoring/Rules.md#rules) raise it, and nothing lowers it back.
$reading = new Reading('server:ovh1', 'system'); $reading->metric('load.1', 0.42)->fact('os', 'Ubuntu 24.04')->raise(Reading::WARNING, 'swap is used');

Index

CRITICAL
LEVELShow bad each status is, to compare them: unknown is better than a warning, as nothing was seen to be wrong
OK
UNKNOWNthe probe could not tell: not installed, no access, the server unreachable for a target's probe
WARNING
alerts
counters
details
duration
facts
message
metrics
probe readonly
status
subject readonly
time
counter($name, $value)
debugName()
detail($name, $value)
fact($name, $value)
FromArray($data) static
isOk()
jsonSerialize()
Level($status) static
metric($name, $value)
raise($status, $message)Make the status at least $status, and say why.
toArray()
toPoint()
Worst($statuses) static
__construct($subject, $probe, $time)

Constantes5

CRITICAL

const CRITICAL = 'critical'

LEVELS

how bad each status is, to compare them: unknown is better than a warning, as nothing was seen to be wrong

const LEVELS = ['ok' => 0, 'unknown' => 1, 'warning' => 2, 'critical' => 3]

OK

const OK = 'ok'

UNKNOWN

the probe could not tell: not installed, no access, the server unreachable for a target's probe

const UNKNOWN = 'unknown'

WARNING

const WARNING = 'warning'

Propriétés11

alerts

array $alerts = []
Type
array

counters

array $counters = []
Type
array

details

array $details = []
Type
array

duration

int $duration = 0
Type
int

facts

array $facts = []
Type
array

message

string $message = ''
Type
string

metrics

array $metrics = []
Type
array

probe

readonly
readonly string $probe
Type
string

status

string $status = 'ok'
Type
string

subject

readonly
readonly string $subject
Type
string

time

int $time
Type
int

Méthodes14

metric($name, $value)

Reading.php:89
function metric(string $name, int|float|null $value): static
$namestring
$valueint | float | null
retournestatica number worth keeping; null (nothing measured) is skipped rather than kept as 0

raise($status, $message)

Reading.php:82

Make the status at least $status, and say why.

function raise(string $status, string $message = ''): static
$statusstring
$message = ''stringadded to what is already said
retournestatic

toArray()

Reading.php:112
function toArray(): array
retournearrayeverything, as kept in the latest readings (latest.json)

Worst($statuses)

staticReading.php:70
static function Worst(string ...$statuses): string
...$statusesstring
retournestringthe worst of $statuses

__construct($subject, $probe, $time)

Reading.php:56
function __construct(string $subject, string $probe, ?int $time = null)
$subjectstringserver:{name} or target:{name}
$probestringthe probe's name (aProbe::NAME)
$time = nullnull | intnull: now