@layer8systems/agent
v0.3.0
Published
Self-hosted agent for Layer8 Systems — polls your mapped devices for reachability and (optionally) auto-discovers a subnet into AssetTrakr + NetMapr, all from inside your own network via the public API.
Maintainers
Readme
@layer8systems/agent
Self-hosted status agent for NetMapr. Layer8 Systems is a cloud service — it has no network path into your private infrastructure, so live device status has to come from something running inside your own network instead.
This agent is that something: it reads the nodes on one of your maps via the public API, checks whether each one is reachable, and pushes the result back. Run it anywhere with line-of-sight to the devices you've mapped — a spare server, a Raspberry Pi, a container.
Setup
Generate an API key from Settings → API Keys in the app, then run:
LAYER8_API_KEY=l8s_... LAYER8_MAP_ID=<your-map-id> npx @layer8systems/agentFind a map's ID in its URL in the app. The agent polls every 60 seconds; each node with an ip or hostname set gets a TCP-connect check (port 443, falling back to 80) and its status/last-verified time updated. Nodes without either are skipped, not marked unreachable.
Auto-discovery (optional)
Set LAYER8_DISCOVER_SUBNET and the agent also sweeps that subnet on a schedule and reconciles the live hosts into AssetTrakr — and, because it's scoped to a map, into that map's NetMapr nodes too. Re-scans are idempotent (matched by MAC, then IP), so nothing duplicates.
LAYER8_API_KEY=l8s_... LAYER8_MAP_ID=<map-id> \
LAYER8_DISCOVER_SUBNET=192.168.1.0/24 \
npx @layer8systems/agentLAYER8_DISCOVER_SUBNET— one or more IPv4 CIDRs (/20 or smaller), comma-separated (e.g.10.0.0.0/24,10.0.1.0/24). Discovery is off unless this is set.LAYER8_DISCOVER_INTERVAL_MS— sweep interval (default3600000, hourly).LAYER8_DISCOVER_LOCATION— optional location label stamped on discovered assets.
Each live host is ICMP-pinged, then TCP-probed on a curated set of common service ports (SSH, HTTP/S, SNMP, RDP, SMB, database, printer, PBX, …). Device type is inferred from the hostname first, then those open ports (e.g. SNMP → switch, 9100 → printer, 3306/5432 → database); the open ports are stored on the asset for service context. MACs come from the OS neighbor table and names from reverse DNS, so run the agent on the target segment.
What this is not
A full monitoring agent — no protocol-aware health checks, no historical uptime, no alerting. It answers one question: "is this node reachable right now?" For anything deeper, point your existing monitoring at the same public API this agent uses.
Local development
LAYER8_API_KEY=... LAYER8_MAP_ID=... LAYER8_API_URL=http://localhost:3000/api node dist/index.js