One project's fleet, watched from this machine: the servers and the sites (targets) its deploy.json declares, the probes run on them, what they saw and what went wrong.
class MMO\admin\monitoring\Hub
Namespace
MMO\admin\monitoring
A hub is a folder holding a `hub.json` (scripts/new-hub.php makes one per project). It declares nothing new about
the fleet -- the deployment declarations already say which machine hosts which client, how to reach it and where
each site lives -- so a server added to `deploy.json` is watched at the next collection:
```json
{
"name": "my.oviepro",
"title": "my.oviepro · fleet",
"declarations": ["~/dev/src/my.oviepro/deploy.json"],
"interval": 300,
"retention": 30,
"probes": {"database": {"engine": "mongodb"}, "logs": {"files": ["{folder}/shared/logs.log"]}},
"rules": [{"metric": "disk.*.usedPercent", "warning": 75, "critical": 90}],
"notify": [{"type": "desktop", "level": "critical"}],
"exclude": ["old-client"],
"links": {"Board": "http://localhost/my.oviepro/developer/boards"}
}
```
Paths may start with `~/` (your home), `{hub}` (the hub's folder) or `{tmp}`; a relative one is the hub's. Every server is
reached exactly as a deployment reaches it: its ssh alias, your agent, the project's credentials file.
The hub's own secrets -- what a probe needs that a deployment does not: the application's `metricsToken`, a
`databaseUri` with a password -- are in `hub.credentials.json` beside it (mode 0600, ignored by git), by target name,
`*` for every target: `{"*": {"metricsToken": "..."}, "client1": {"databaseUri": "mongodb://..."}}`.
$hub = Hub::FromFile('~/hubs/my.oviepro/hub.json');
$hub->collect(); // every probe on every server and site, kept in {hub}/data
$hub->overview(); // what the dashboard shows
What was deployed: this machine's history (mmo.admin's sync, and every release made from here), and what the release probe last read of each target's own journal -- so a hub knows the deployments…
Run the probes on the subjects, judge, keep, open and resolve incidents.
function collect(
?array $subjects = null,
?array $probes = null,
?callable $progress = null,
?int $time = null
): arrayServers are reached once each: a server that does not answer makes every probe of its targets that needs its shell
`unknown` (the server itself is the critical one), without trying again for each. The http probes still run: they
ask from here, and say what the users see.
What was deployed: this machine's history (mmo.admin's sync, and every release made from here), and what the release probe last read of each target's own journal -- so a hub knows the deployments made from another machine without a sync.
function deployments(?string $target = null, int $count = 50): array