Documentation
¶
Overview ¶
Package mikroscope exists for one reason: it is the only package that can read the repository's VERSION file at compile time.
A go:embed directive cannot reach outside its own package directory, and VERSION sits at the module root because everything that has to agree on a release number reads it from there: the Makefile, GoReleaser's agent image tars and the release workflow's preflight, which refuses to release when the pushed tag and the file disagree. A package at the root can embed it; nothing under cmd/ or internal/ can.
Without this, a build nobody stamped reports "dev". That was true of every `go build`, every `go run ./cmd/mikroscope image` and therefore of every agent image tar built from one, because the real number only ever arrived through the release ldflags, and a plausible wrong version is not something anyone notices on a router.
Index ¶
Constants ¶
This section is empty.
Variables ¶
var Version = strings.TrimSpace(versionFile)
Version is the release this build was compiled from. It is the floor, never a guess: release ldflags may still override what a command reports, which is what happens when a tag names a number the file has not caught up with yet.
Functions ¶
This section is empty.
Types ¶
This section is empty.
Directories
¶
| Path | Synopsis |
|---|---|
|
cmd
|
|
|
gen_brand
command
Command gen_brand writes the mikroscope mark, and the compositions built on it.
|
Command gen_brand writes the mikroscope mark, and the compositions built on it. |
|
gen_rsc
command
Command gen_rsc writes the steps spec and its case matrix for the site's install script generator and manual install pages, which render RouterOS commands from them instead of keeping a copy of their own:
|
Command gen_rsc writes the steps spec and its case matrix for the site's install script generator and manual install pages, which render RouterOS commands from them instead of keeping a copy of their own: |
|
mikroscope
command
Command mikroscope is the operator-side CLI: it installs the agent on a RouterOS device, removes it, shows what it would write, and — from Phase 5 and 6 on — records, plots and forwards.
|
Command mikroscope is the operator-side CLI: it installs the agent on a RouterOS device, removes it, shows what it would write, and — from Phase 5 and 6 on — records, plots and forwards. |
|
mikroscope-agent
command
Command mikroscope-agent runs on the RouterOS device, inside a scratch container, and samples the shared kernel's /proc at a fixed rate into a ring buffer it serves over HTTP on the veth.
|
Command mikroscope-agent runs on the RouterOS device, inside a scratch container, and samples the shared kernel's /proc at a fixed rate into a ring buffer it serves over HTTP on the veth. |
|
mikroscope-lab
command
Command mikroscope-lab drives the virtual RouterOS lab: MikroTik's Cloud Hosted Router under QEMU in a Docker container, which every RouterOS test of the project runs against (test/lab/README.md).
|
Command mikroscope-lab drives the virtual RouterOS lab: MikroTik's Cloud Hosted Router under QEMU in a Docker container, which every RouterOS test of the project runs against (test/lab/README.md). |
|
internal
|
|
|
agent
Package agent is what runs on the router: a sampler that reads /proc at a fixed rate into a ring buffer, and an HTTP server on the veth that hands the ring out as NDJSON and as Prometheus text.
|
Package agent is what runs on the router: a sampler that reads /proc at a fixed rate into a ring buffer, and an HTTP server on the veth that hands the ring out as NDJSON and as Prometheus text. |
|
apitier
Package apitier samples what the container cannot see, over one persistent RouterOS API connection at 1 Hz: per-core load as RouterOS reports it, memory, health, interface rates, and, opt-in at its own cadence, the conntrack count.
|
Package apitier samples what the container cannot see, over one persistent RouterOS API connection at 1 Hz: per-core load as RouterOS reports it, memory, health, interface rates, and, opt-in at its own cadence, the conntrack count. |
|
chart
Package chart draws a recording as a deterministic SVG: three panels on one time axis — per-core busy ratio, softnet drops and time squeezes per second, memory available — with the recording's markers as dashed verticals.
|
Package chart draws a recording as a deterministic SVG: three panels on one time axis — per-core busy ratio, softnet drops and time squeezes per second, memory available — with the recording's markers as dashed verticals. |
|
dashboards
Package dashboards generates the Grafana dashboards, one per store, in the shareable export format: a `${DS_…}` datasource placeholder declared in `__inputs`, a fixed `uid` so a re-import updates in place, and `__requires` for the directory listing.
|
Package dashboards generates the Grafana dashboards, one per store, in the shareable export format: a `${DS_…}` datasource placeholder declared in `__inputs`, a fixed `uid` so a re-import updates in place, and `__requires` for the directory listing. |
|
derive
Package derive is the collector's derive stage: what can be computed from the samples with no cost on the device, identically for every sink, and with state across samples that a query language expresses badly and a sink cannot express at all.
|
Package derive is the collector's derive stage: what can be computed from the samples with no cost on the device, identically for every sink, and with state across samples that a query language expresses badly and a sink cannot express at all. |
|
forward
Package forward is the collector: it pulls the kernel tier from the agent, samples the API tier at 1 Hz, stamps both in the agent's clock and fans the merged timeline out to sinks.
|
Package forward is the collector: it pulls the kernel tier from the agent, samples the API tier at 1 Hz, stamps both in the agent's clock and fans the merged timeline out to sinks. |
|
health
Package health reads a window of the agent's samples and names the faults it shows: the ones that are happening NOW, in the ring the agent still holds.
|
Package health reads a window of the agent's samples and names the faults it shows: the ones that are happening NOW, in the ring the agent still holds. |
|
image
Package image builds the agent's container image without Docker: a cross-compiled static binary packed into a docker-save-format tar that RouterOS's `/container/add file=` accepts.
|
Package image builds the agent's container image without Docker: a cross-compiled static binary packed into a docker-save-format tar that RouterOS's `/container/add file=` accepts. |
|
lab
Package lab drives the virtual RouterOS lab: MikroTik's Cloud Hosted Router under QEMU in a Docker container, provisioned once into a clean snapshot (the container package installed, device-mode container=yes confirmed) and put back to it in seconds.
|
Package lab drives the virtual RouterOS lab: MikroTik's Cloud Hosted Router under QEMU in a Docker container, provisioned once into a clean snapshot (the container package installed, device-mode container=yes confirmed) and put back to it in seconds. |
|
lab/vm
Package vm is the lab container's side of the virtual RouterOS lab: what runs inside `mikroscope-lab-<arch>` as its PID 1, and what runs inside the throwaway container `mikroscope-lab cli` starts in the lab's network namespace.
|
Package vm is the lab container's side of the virtual RouterOS lab: what runs inside `mikroscope-lab-<arch>` as its PID 1, and what runs inside the throwaway container `mikroscope-lab cli` starts in the lab's network namespace. |
|
procfs
Package procfs parses the /proc files the mikroscope agent samples into typed counters.
|
Package procfs parses the /proc files the mikroscope agent samples into typed counters. |
|
record
Package record is the diagnostician's path: pull samples from the agent for a window, write them as JSONL (verbatim) and CSV (wide), and keep a marker file where every line typed on stdin, every gap and — opt-in — every router log line lands with the agent's timestamp, so "what happened at 14:03" has an answer.
|
Package record is the diagnostician's path: pull samples from the agent for a window, write them as JSONL (verbatim) and CSV (wide), and keep a marker file where every line typed on stdin, every gap and — opt-in — every router log line lands with the agent's timestamp, so "what happened at 14:03" has an answer. |
|
rosapi
Package routeros is a pure Go client library for accessing Mikrotik devices using the RouterOS API.
|
Package routeros is a pure Go client library for accessing Mikrotik devices using the RouterOS API. |
|
router
Package router deploys the mikroscope agent to a RouterOS device and removes it again, with the containment rules inherited from cs-routeros-bouncer cmd/perfmon (PR #123): every object created carries one exact comment tag, every removal selects by that tag plus the object's identity — never by pattern — and uninstall verifies by ownership counts before it reports success.
|
Package router deploys the mikroscope agent to a RouterOS device and removes it again, with the containment rules inherited from cs-routeros-bouncer cmd/perfmon (PR #123): every object created carries one exact comment tag, every removal selects by that tag plus the object's identity — never by pattern — and uninstall verifies by ownership counts before it reports success. |
|
sample
Package sample defines what one tick of the mikroscope agent produces: the deltas of every counter since the previous tick, plus the few absolute values that are not counters.
|
Package sample defines what one tick of the mikroscope agent produces: the deltas of every counter since the previous tick, plus the few absolute values that are not counters. |
|
sinks
Package sinks receives the merged timeline — kernel-tier samples at the agent's rate, API-tier samples at 1 Hz, gaps — and writes it somewhere: a JSONL file, a Prometheus /metrics, InfluxDB 3 line protocol.
|
Package sinks receives the merged timeline — kernel-tier samples at the agent's rate, API-tier samples at 1 Hz, gaps — and writes it somewhere: a JSONL file, a Prometheus /metrics, InfluxDB 3 line protocol. |
|
teardown
Package teardown removes what a collector left in a store.
|
Package teardown removes what a collector left in a store. |
|
transport
Package transport reaches the agent's HTTP from the operator host.
|
Package transport reaches the agent's HTTP from the operator host. |
|
version
Package version carries the build identity both binaries report.
|
Package version carries the build identity both binaries report. |
|
test
|
|
|
e2e/fakeagent
Package fakeagent is a stand-in for the mikroscope agent: the HTTP paths a deployment reads — /healthz, /capabilities, /snapshot, /stream and the /metrics a Prometheus scrapes — serving canned samples built from internal/sample's own types rather than from hand-written JSON, so a field that is renamed in the sample cannot quietly stop being tested here.
|
Package fakeagent is a stand-in for the mikroscope agent: the HTTP paths a deployment reads — /healthz, /capabilities, /snapshot, /stream and the /metrics a Prometheus scrapes — serving canned samples built from internal/sample's own types rather than from hand-written JSON, so a field that is renamed in the sample cannot quietly stop being tested here. |


