Seven checks over HTTP, covering the whole fleet from a single service definition.
Content Caching Monitor answers checks at /check/<name> as JSON. Each check evaluates the entire fleet and returns one verdict, so you define one service rather than one per caching server.
Checks are served by the collector — the background service that receives your servers' reports — on the same port it uses for reporting, 17440 unless you changed it.
In Settings > Monitoring, tick Nagios and compatible systems, then set a username and password under Access. The pane shows the check URL and offers to copy it.
404 while disabled.503.| Check | Evaluates | Default thresholds |
|---|---|---|
status | Servers offline, not reporting, never reported, not registered with Apple, or whose agent was removed; a warning while servers only await their first report | — |
pressure | Worst cache pressure in the fleet, 0–100 | Settings > Warnings (w=60 c=100 until changed) |
efficiency | Fleet cache hit rate over the last hour, per cent | w=60 c=40 |
throughput | Each server's peak 15-minute throughput over the last hour, as a share of its own link; names the server nearest its limit | Settings > Warnings (60% and 80% of the link until changed). A probe's own w=/c= are Gbps, against the busiest server |
rejected | Requests refused for want of space | w=1 c=100 |
gaps | Reporting gaps detected in the last 24 hours | w=1 c=10 |
lost | Reports the caching service abandoned before the agent answered (agent-assisted reporting servers) | w=1 c=10 |
A warning switched off in Settings > Warnings is off here too: pressure and throughput then answer OK, saying so, unless the probe passes its own ?w= and ?c=. The password must be at least 8 characters, and an address that gets the login wrong five times in a row is answered 429 for a minute.
efficiency inverts. Lower is worse, so warning is the higher number. A fleet that served nothing in the last hour returns OK rather than 0% — a cache with no traffic has not failed, and treating it as a failure pages somebody every quiet night.
curl -u monitor:your-password http://your-mac.local:17440/check/status
{
"state": 0,
"status": "OK",
"message": "7 server(s) reporting",
"performance": { "servers": 7 }
}
Override thresholds with w and c:
curl -u monitor:pw 'http://your-mac.local:17440/check/pressure?w=40&c=80'
The state field is already the Nagios exit code:
| state | status | Meaning |
|---|---|---|
0 | OK | Within thresholds |
1 | WARNING | Warning threshold reached |
2 | CRITICAL | Critical threshold reached |
3 | UNKNOWN | No servers enrolled, or an unrecognised check name |
404 means the endpoint is disabled, 401 means bad credentials, 503 means none are configured.
Nagios needs an exit code and a status line. This turns the JSON into both — place it in your plugins directory as check_content_caching:
#!/bin/bash
# usage: check_content_caching <host:port> <check> [w] [c]
HOST="$1"; CHECK="$2"; W="$3"; C="$4"
URL="http://$HOST/check/$CHECK"
[ -n "$W" ] && URL="$URL?w=$W&c=$C"
# The login reaches curl on its standard input: printf is a shell built-in, so it
# never appears in a process list, as "-u user:password" would.
BODY=$(printf 'user = "%s:%s"\n' "$CCM_USER" "$CCM_PASSWORD" | curl -sf -K - "$URL") || {
echo "UNKNOWN - collector unreachable or endpoint disabled"; exit 3; }
STATUS=$(echo "$BODY" | /usr/bin/python3 -c 'import json,sys;print(json.load(sys.stdin)["status"])')
MSG=$(echo "$BODY" | /usr/bin/python3 -c 'import json,sys;print(json.load(sys.stdin)["message"])')
CODE=$(echo "$BODY" | /usr/bin/python3 -c 'import json,sys;print(json.load(sys.stdin)["state"])')
echo "$STATUS - $MSG"
exit "$CODE"
$CCM_USER and $CCM_PASSWORD from the environment and hands them to curl on its standard input; passing them as arguments, to the script or to curl -u, would put them in the process list of every check run. (A password containing " or \ needs those escaped with a backslash for curl -K.)
define command {
command_name check_content_caching
command_line $USER1$/check_content_caching $ARG1$ $ARG2$ $ARG3$ $ARG4$
}
define service {
use generic-service
host_name monitor-mac
service_description Content Caching — fleet status
check_command check_content_caching!your-mac.local:17440!status
}
define service {
use generic-service
host_name monitor-mac
service_description Content Caching — cache pressure
check_command check_content_caching!your-mac.local:17440!pressure!40!80
}
define service {
use generic-service
host_name monitor-mac
service_description Content Caching — reports lost
check_command check_content_caching!your-mac.local:17440!lost
}
Note the host: every service is defined against the Mac running Content Caching Monitor, not against the caching servers.
object CheckCommand "content_caching" {
command = [ PluginDir + "/check_content_caching" ]
arguments = {
"(no key)" = {{ macro("$ccm_target$") }}
"(no key2)" = {{ macro("$ccm_check$") }}
}
vars.ccm_target = "your-mac.local:17440"
}
apply Service "content-caching-status" {
check_command = "content_caching"
vars.ccm_check = "status"
assign where host.name == "monitor-mac"
}
status — the one to page on. A server whose agent was removed reports CRITICAL and will not clear by itself; acknowledge it by removing the server from the fleet.lost and gaps — both mean reports that no longer exist. lost is the agent's own count and is direct evidence; gaps is inferred from missing report windows.pressure at 100 means requests are being refused for want of space — the only value in the scale that represents active harm rather than a warning sign.