@intflow/sentinelctl
v0.11.2
Published
Sentinel Fleet Console CLI: search device logs, inspect status and metrics, edit metadata, manage roles and create access keys for MCP
Readme
sentinelctl
Command-line client for Sentinel Fleet Console (https://monitor.intflow.dev): search device logs, inspect device status and metrics, edit device metadata and manage console roles. It uses the same Intflow (Google Workspace) login and the same role checks as the web console.
- Node.js 20+, no dependencies.
- Roles:
viewerreads,editoralso edits metadata,adminalso sees raw log fields, imports/exports metadata and manages users. The server enforces roles; the CLI also checks your role before sending a request that would be refused.
Install
npm install -g @intflow/sentinelctl # or the short alias: npm install -g sentinelctlsentinelctl is an alias package that runs @intflow/sentinelctl. Install only one of them.
Log in
sentinelctl login- The terminal prints an approval URL and a confirmation code (e.g.
BCDF-GHJK) and opens the browser. Over SSH, add--no-browserand open the URL yourself. - Sign in with your intflow.ai account, check that the browser shows the same code, and approve.
- The CLI stores a 30-day token in an owner-only (0600) credentials file.
sentinelctl whoami
sentinelctl sessions list # your web sessions, CLI tokens and access keys
sentinelctl logout # revoke on the server and delete local credentialsCredentials live in ~/.config/sentinelctl/credentials.json (Linux/macOS) or %APPDATA%\sentinelctl\credentials.json (Windows); override with SENTINELCTL_CONFIG. The server is taken from --server, then SENTINEL_URL, then the saved profile, then the default. Automation can pass SENTINEL_TOKEN instead of a credentials file.
Access keys and MCP
An access key is a long-lived credential for MCP clients and scripts. It carries your account and your current role, and it keeps working without any browser or CLI login: logging out, an expired web session or a revoked CLI token do not affect it.
sentinelctl access create "work laptop" # read key, printed once
sentinelctl access create "metadata bot" --access full # may also change data
sentinelctl access list # shows the ACCESS level
sentinelctl access revoke <key-id>- Every key has one level, chosen when it is created and never changed:
read(the default) runs only commands that do not change data;fullruns everything your role allows. With a read key, MCP lists only read-only tools and the server answers a request that changes data with 403read_only_key(exit code 3). For another level, create a new key. - A key lasts 30 days. Each time it is used a week or more after its last extension it gains 7 days, so a key in regular use does not expire. An unused key expires after 30 days.
- Up to 10 keys per person. Keys are created and revoked only from a web or CLI login, never with another key.
- The key stops working when you revoke it or an admin disables your account. A role change applies on the next request.
The console serves every command of this CLI as a remote MCP tool at /api/mcp/ (Streamable HTTP). Nothing is installed on the client, and new server releases update the tools. Any MCP client that supports Streamable HTTP with custom headers can connect:
- URL:
https://monitor.intflow.dev/api/mcp/ - Header:
Authorization: Bearer <access key>
{ "mcpServers": { "sentinel": { "type": "http", "url": "https://monitor.intflow.dev/api/mcp/", "headers": { "Authorization": "Bearer sentinel_..." } } } }Clients that register servers by command take the same two values, for example claude mcp add --transport http sentinel https://monitor.intflow.dev/api/mcp/ --header "Authorization: Bearer sentinel_...". Tools are named sentinel_<group>_<command> (for example sentinel_logs_stats) and take the same options; the tool list contains only what your role and the key level allow. The same key also works as SENTINEL_TOKEN for this CLI.
Connect your event collector
Signed-in users can register and manage sources they own. Existing sources without an owner remain admin-managed, and source stages are admin-only. A read access key cannot register or change sources.
sentinelctl sources register billing-monitor --nature monitor --name "Billing monitor" --category incident --every 60
sentinelctl sources list --mine
sentinelctl sources connection billing-monitor -o json
mkdir -m 700 ./collector-secrets
sentinelctl sources keys issue billing-monitor --output-file ./collector-secrets/billing.key
sentinelctl sources test billing-monitor --key-file ./collector-secrets/billing.key -o json
sentinelctl sources diagnostics billing-monitor -o jsonKey output requires a new file in an existing owner-only directory. The CLI writes mode 0600 and omits the token from its output. Key issuance and test delivery are intentionally unavailable through MCP; MCP can register sources, read connection examples and inspect diagnostics without receiving a source write key.
The test succeeds only after Sentinel accepts its unique test event and the CLI finds the same event ID and source in central search. A heartbeat alone does not establish delivery of incidents or reports; diagnostics shows each kind separately.
Getting help
sentinelctl --help # overview
sentinelctl logs search --help # one command: options, examples, required role, output fields
sentinelctl help agents # guide for AI agents and scripts
sentinelctl commands --json # machine-readable catalog of every command
sentinelctl commands logs --json # only one group (or "logs stats" for one command)Mistyped commands and options get a suggestion (Did you mean --range?), and every error comes with a hint for the next step.
Fleet overview and metrics
sentinelctl fleet wallboard --edge-only --limit 10 -o json # wallboard attention, recovery and field operations
sentinelctl fleet summary # status, offline split, attention, busiest devices, trends, log levels, error patterns
sentinelctl fleet summary -r 1h -o json # about 10KB
sentinelctl metrics top memory -r 7d # devices ranked by 7-day average memory + fleet distribution
sentinelctl metrics top disk --agg last --above 85 --top 50
sentinelctl metrics top diskDaysLeft --below 14 # disks that fill up within two weeks at the current growth
sentinelctl metrics top cpu --agg p95 -r 24h --compare --sort change
sentinelctl metrics top reboots -r 7d --above 0 # many devices reboot daily on schedule; compare with p50
sentinelctl metrics top networkTx -r 24h --label fleet=edge -o json
sentinelctl devices correlate <agent-id> --peak cpu -r 24h # metrics and logs around the CPU peak
sentinelctl devices correlate <agent-id> --at 2026-09-30T14:58:00+09:00 --window 30mmetrics top runs one query over every device: --agg avg|max|min|p95|last per device over -r 1h|6h|24h|7d|30d (or --from/--to, up to 30 days), ranked, with min/p50/p90/p95/max across devices. Metrics: cpu, memory, disk, swap, load, temperature, processes, tcpConnections, networkRx, networkTx, reboots, diskDaysLeft. --compare adds the previous window of the same length. Device filters work like devices list; retired devices are excluded by default.
Logs: count first, read last
sentinelctl logs stats -l error -r 24h --by message --compare # which patterns, what changed
sentinelctl logs groups -l error -r 24h # every device x source x pattern, with count, first/last and latest line
sentinelctl logs stats -p "<pattern>" --by agent --timeline -r 7d # where and since when
sentinelctl logs search -p "<pattern>" -a <agent-id> -r 24h -n 50 # a few raw lines
sentinelctl logs context -a <agent-id> -s app.service -t 2026-09-30T01:02:03.456Z
sentinelctl logs facets -l error -r 24h # top devices, sources, severities at a glance
sentinelctl logs histogram -a <agent-id> -r 30d
sentinelctl logs sources -r 24h
sentinelctl logs stats --service payment-api --env prod -l error -r 7d --by message # one application across devices (needs service/env labels)
sentinelctl logs stats -l error -r 24h --by service
sentinelctl logs search -l error --since <nextSince> -o ndjson # poll only new logslogs searchreturns at most 10,000 lines (250 per request,--pages Nup to 40 or--all). On a busy fleet that covers minutes, so never download logs to count or summarize them:logs statsandlogs groupscount every log in the window on the server.-p/--patterntakes a pattern exactly aslogs stats --by messageorlogs groupsprint it (numbers as<N>) and matches only that pattern.-qmatches words case-insensitively; add--case-sensitivefor a much faster exact-case match.--dedupefolds lines repeated within the same second;--collapseonlogs searchis the same aslogs groups.- Windows:
15m,1h,6h,24h,7d,30dor--from/--toup to the retention period (31 days by default). Fleet-wide aggregations over 7 days need-a,-s,-por--case-sensitive; the server answerslog_query_too_broadotherwise. - Aggregations over a day are computed per day and finished days are cached, so repeating a long query is cheap; the CLI continues automatically when the server needs several requests.
- Levels:
emergency,criticalanderrorinclude more severe levels;warning,info(with notice) anddebugmatch that level only. --fields(raw fields) is admin-only and audited.--followpolls at most every 5 seconds and is meant for humans.
Each user can run 2 log queries and 2 metric aggregations at a time (web and CLI combined) and spend 60 seconds of log query time per minute; GET requests that get 429 retry automatically with backoff.
Devices and metadata
sentinelctl devices list --status offline
sentinelctl devices list --focus attention --all -o json
sentinelctl devices show <agent-id> -r 24h -o json
sentinelctl devices lookup edge-01
sentinelctl devices overview <agent-id> -r 7d
sentinelctl health
sentinelctl metadata get <agent-id>
sentinelctl metadata history <agent-id>
sentinelctl metadata set <agent-id> --display-name "Edge 1" --label site=seoul --dry-run # editor
sentinelctl metadata set <agent-id> --lifecycle maintenance --maintenance-until 2026-10-01T09:00:00+09:00
sentinelctl metadata bulk id1 id2 id3 --role camera --dry-run # editor, up to 100
sentinelctl metadata rollback <agent-id> --to 3
sentinelctl metadata export --file backup.json # admin
sentinelctl metadata import backup.json --dry-run # adminmetadata set and metadata bulk read the latest revision and apply on top of it. If someone saves in between, the server answers 409; run the command again.
Admin
sentinelctl admin users
sentinelctl admin grant [email protected] --role editor # works before the first login
sentinelctl admin reset [email protected] # back to the default viewer
sentinelctl admin disable [email protected] # block access and end all sessions, tokens and keys now
sentinelctl admin sessions --kind access # web, cli or access
sentinelctl admin revoke <session-id>
sentinelctl admin audit --cleanup
sentinelctl admin operations -r 7dAny other endpoint: sentinelctl api "/api/devices?status=offline".
Event sources and the event specification
Monitors, applications and infrastructure that send intflow.event.v1 events are registered as sources. Reading is open to every role; changes need admin (and a full key when you use an access key).
sentinelctl events schema -o json # JSON Schema, reason codes and example events
sentinelctl sources list # stage, expected reporting and key state per source
sentinelctl sources show nas-super-monitor -o json # key expiry state, never the key itself
sentinelctl sources register nas-super-monitor --nature monitor --name "NAS SUPER" --category incident \
--subject nas:nas-super --every 60 --legacy-room mon --critical availability_lost
sentinelctl sources update app-backup --cron "1 3 * * *" --grace 3600
sentinelctl sources update db-monitor --clear runbook
sentinelctl sources stage nas-super-monitor shadow --reason "parallel run starts"
sentinelctl sources retire edgefarm-efc-stale-mail --reason "merged"
sentinelctl sources keys issue nas-super-monitor # sfauto_ key, events:write, 365 days, shown once
sentinelctl sources keys issue nas-super-monitor --replace
sentinelctl sources keys revoke nas-super-monitor- A new source starts at stage
store.sources stagemoves one step at a time alongstore → shadow → live → cut_over, or one step back. --every(seconds) or--cronwith--grace(five cron fields in KST, seconds of grace) set the expected reporting.--criticalreplaces the list of critical checks.- One valid write key per source. It writes events for that source only, expires after 365 days and shows
expiringinsources listandsources showfrom 30 days before.sources retirerevokes it at once. sources keys issueis not offered as an MCP tool so that a key is never shown inside an AI conversation; use the CLI.
Received events (server v1.15.0 or newer, with event ingest switched on) can be searched and checked per source:
sentinelctl events search --source nas-super-monitor --range 7d # newest received first, default 24h, up to 200
sentinelctl events search --kind incident --state firing --severity critical -o json
sentinelctl events search --subject nas-super --check availability_lost --from 2026-11-01T00:00:00+09:00 --to 2026-11-02T00:00:00+09:00
sentinelctl events search --event-type backup.completed --correlation-id run:42 --data '{"job.duration_s":42,"ok":true}' -o json
sentinelctl events stats --event-type backup.completed --by data.job.duration_s --range 24h -o json
sentinelctl events freshness # age of the last accepted event per source and kind- Search covers the events tenant only and stays inside the VictoriaLogs retention (about 3 months); a wider window is refused with
range_beyond_retention. Time filters use the time Sentinel received the event. - Each result is
{receivedAt, event}with the event exactly as sent; select fields with--select receivedAt,event.summary. --event-typeand--correlation-idmatch exact domain identifiers.--datais a JSON object whose path/value conditions are ANDed: at most 8 paths, 2048 compact UTF-8 JSON bytes, 4 path levels and 260 characters per path, and 256 characters per string value. Values are strings, finite numbers, booleans or null. Paths such aschecks[0].duration_sselect array entries; array indices are 0–63. A number, a numeric string, null and a missing path remain distinct.events stats --byacceptssource,kind,severity,state,subject,check,event_type,correlation_idordata.<path>. Data groups return scalarkeyplusvalueType(string,number,boolean,null); missing paths are omitted, andtotalcounts events with a scalar value at that path. Table output uses JSON notation to distinguish42from"42", includingfalse,0andnull.nextCursorfixes the receive window, filters and limit for one hour, or until the server restarts. Keep all conditions while continuing; the order and whitespace of the--dataobject do not matter.events histogramuses the same filters and returns at most 500 time buckets.
Updates
Each ordinary launch makes a bounded registry check and selects a verified exact stable release in a private per-user cache. Global, local and npx installations are left intact. TTY, pipes and JSON use the same policy; the original command runs once. A failed lookup or preparation keeps the verified runtime. Releases need update protocol 1, compatible Node engines, a load probe and matching version before activation.
update --check (the default) checks without installing; --apply explicitly prepares the selected release; --status reports selection without a registry request. --auto on|off persists the policy. --pin VERSION verifies and prepares that exact version before changing the pin and selection together; a failed pin leaves both unchanged. A pin takes precedence, and --unpin only removes it. Update actions cannot be combined. These controls, help, version and --runtime-probe never install automatically.
INTFLOW_CLI_AUTO_UPDATE=0 or SENTINELCTL_AUTO_UPDATE=0 freezes the selected runtime. SENTINELCTL_UPDATE_CHECK=0 bypasses the cache and runs the base installation. An explicit update --apply remains available while automatic selection is off. Old installations need one manual upgrade to this bootstrap-capable CLI. The server's separate minimum-version check still returns exit code 3; API update notices can be silenced with SENTINELCTL_NO_UPDATE_NOTICE=1.
Output and exit codes
--select agentId,displayName,status,metadata.rolekeeps only those fields of each item in json/ndjson output (plus top-level scalars), e.g.devices list --all -o jsondrops from ~700KB to ~20KB.devices show --series none(or--series cpu,memory) drops time series.-o table(default),-o json(--json),-o ndjson. Data goes to stdout; summaries, hints and errors go to stderr (--quietdrops summaries and hints). With json/ndjson, an error is one stderr line:{"error":{"status","code","message","hint","exitCode"}}.- Exit codes:
0success,1server or network error,2usage error,3not logged in or insufficient role. - Server error messages are Korean because the web console shares them; hints are English.
Publishing
Keep both package versions, the alias dependency and config/dashboard.json's cliLatestVersion equal; node scripts/check-cli-release.mjs checks them. Both packages identify the working GitHub repository in repository.url, as required for trusted publishing.
- Run
gh workflow run publish-cli.yml --repo yeon3724/intflow-sentinel --ref main -f publish=false. The self-hosted runner checks versions, tests and both pack contents without publishing. - From that clean, verified commit, run
npm pack --pack-destination <absolute-output-directory>incli/andcli/unscoped/. Keep the commit and tarball checksums with the artifacts. A maintainer signs in withnpm login --auth-type=weband publishes the scoped tarball withnpm publish <tarball> --access public, completing npm's 2FA approval. Confirm its exact version withnpm view @intflow/[email protected] version, then publish and confirm the alias tarball the same way. - After both exact versions are public, create the immutable annotated tag on that verified commit:
git tag -a cli-v0.11.0 <verified-commit> -m 'Sentinel CLI 0.11.0', thengit push origin cli-v0.11.0.
A tag always runs the self-hosted checks. If both exact package versions are public, the hosted publisher is skipped. A missing version or uncertain registry lookup keeps the existing trusted-publishing path: scoped package, registry confirmation, then alias; versions already present are skipped. This path needs a GitHub-hosted runner. For each package, npm Settings → Trusted Publisher must use yeon3724, repository intflow-sentinel, workflow publish-cli.yml, environment npm; verify the settings after a repository rename.
Updating the NAS Compose DASHBOARD_CLI_LATEST_VERSION pin is a separate deployment step, after both packages are public.
