Your own metrics
Anything you can measure with a script can be a metric: internet speed, a website’s response time, a backup’s age, a UPS’s battery. mm-core runs the script on a timer, and what it prints shows up like any other metric: on the Fleet and machine pages, in history and charts, and in alert rules. Values past a script’s red level raise an alert at once.
There are ready-made examples, and the dashboard’s Settings → Script editor helps with every step below.

Add a script
Section titled “Add a script”-
Try it on the machine that will run it. This runs it as you, shows what it would report or exactly what’s wrong, and says whether the service would refuse the file:
Terminal window mm-core exec test /path/to/script.sh -
Put it where only an administrator can change it. The script runs with mm-core’s rights, so mm-core refuses a file anyone else could change.
Terminal window sudo install -D -m 755 ping.sh /usr/local/lib/mm/scripts/ping.shTerminal window mkdir -p ~/Library/Application\ Support/mm/scriptscp ping.sh ~/Library/Application\ Support/mm/scripts/chmod 755 ~/Library/Application\ Support/mm/scripts/ping.shIn an Administrator PowerShell. Copy the file rather than moving it: a moved file keeps permissions that usually let its owner change it, and mm-core refuses it.
Terminal window New-Item -ItemType Directory C:\ProgramData\mm\scriptsCopy-Item ping.ps1 C:\ProgramData\mm\scripts\ -
Add it to the machine’s config as an
[[exec]]entry (see where the config is):[[exec]]name = "ping" # lowercase letters, digits, - and _command = ["/usr/local/lib/mm/scripts/ping.sh", "192.168.0.1", "1.1.1.1"]interval_s = 60 # how often: 5 to 86400 s (default 60)timeout_s = 30 # stopped after: 1 to 600 s (default 10)On Windows, run PowerShell scripts through PowerShell:
command = ["powershell.exe", "-NoProfile", "-ExecutionPolicy", "Bypass", "-File", "C:\\ProgramData\\mm\\scripts\\ping.ps1", "1.1.1.1"]The command runs directly, not through a shell.
-
Save. mm-core notices within a few seconds and restarts with it. If the file has a mistake, it keeps its old settings and the dashboard says what’s wrong. Settings → My scripts (or
mm-core exec) shows how each script is doing; its metrics appear on the machine’s My scripts tab.
The examples
Section titled “The examples”In the repository’s examples/exec folder,
and in the Script editor, which lists them by system. Each one’s comments say what it needs, which
systems it runs on, and give its [[exec]] entry.
| Script | What it shows | Notes |
|---|---|---|
internet-speed.sh / .ps1 |
Download and upload speed, latency | Cloudflare’s speed test, about 30 MB a run |
ping.sh / .ps1 |
Round-trip time and packet loss to each host | Loss over 25% shows red |
website.sh / .ps1 |
Whether each URL answers, response time, HTTP status | A site that’s down shows red |
cert-expiry.sh |
Days until each HTTPS certificate runs out | Pair it with an alert rule below 14 days |
backup-age.sh / .ps1 |
Hours since each backup folder changed, and its size | Amber after 26 hours, red after 48 |
updates.sh |
Updates waiting, security updates, restart needed | Linux, apt or dnf; installs nothing |
ups.sh |
UPS battery, time left, load, on battery | Network UPS Tools |
docker.sh |
Each container’s state, CPU and memory | Docker access is as good as root: read its warning |
trash.sh |
Trash size and items | macOS |
Writing your own
Section titled “Writing your own”A script prints JSON, one object per line. First a describe line, saying what it measures:
{"describe": [{"id": "battery", "title": "UPS battery", "unit": "%", "kind": "gauge", "min": 0, "max": 100, "crit": 95}]}Then one or more samples lines with the values:
{"samples": [{"id": "battery", "value": 97}]}At startup mm-core runs each script once with MM_DESCRIBE=1, to read what it measures. A script can
print its describe line and stop straight away:
echo '{"describe": [...]}'[ "${MM_DESCRIBE:-}" = 1 ] && exit 0A metric (in describe):
| Field | |
|---|---|
id |
Lowercase letters, digits, . _ -. It becomes exec.<name>.<id>, such as exec.ups.battery |
title |
What people see |
unit |
%, By (bytes), By/s, bit/s, s, Cel are formatted for you; anything else is shown after the number |
kind |
gauge (a value now), counter (a total that only goes up; shown as a rate), state or info (text) |
labels |
Up to 4 label names, for one metric with several series: ["host"] |
min, max |
The range, for gauges and bars |
warn, crit |
Amber at warn, red at crit (higher is worse). Red raises an alert at once |
help |
A sentence about what it is and what’s normal |
At most 32 metrics per script.
A sample (in samples): id, value (a number), labels (the metric’s label names, values up to
200 characters), and text instead of value for state and info metrics. At most 500 per run.
Failing: exit with a non-zero code and say why on standard error. The last line shows in Settings →
My scripts and in mm-core exec.
Limits: up to 256 KB of output a run. A script still running at its timeout is stopped, with anything it started, and it’s never started twice at once.
Safety
Section titled “Safety”A script runs as mm-core does: its own mm account on Linux, your account on macOS, LocalService on
Windows. mm-core checks the program and every file named in the command, and refuses any that someone
other than an administrator (or mm-core itself) could change, including through the folders above it.
Settings → My scripts says which file failed and why. Think before giving mm-core’s account more access,
such as the Docker group.