agentleFS
ryanmacleanryanmaclean/skills/bsd-dog-ops/SKILL.md

bsd-dog-ops

Skill1 starsChanged 2 months agoMITView on GitHub

Operate the bsd-dog lean C telemetry daemons — deploy, verify, and debug metrics/logs/traces lanes on FreeBSD (fbryz3070) and ARM Linux MiSTer boards (mister/de10nano 10.0.2.61, superstation1 10.0.3.136). Use when restarting lanes, checking sole-agent state, debugging "accepted but not indexed" intake issues, or making boot persistence changes.

  • Reads credentials

The file

We split this skill into the rules it gives an agent

2 rules. About 0 are common, 0 are distinctive, and 2 are very specific to this project.

  • ≈0

    Common · estimate

    Many files like this have a rule of this kind.

  • ≈0

    Distinctive · estimate

    This author's own choices. Worth a look.

  • 2

    Very specific

    Tied to their project's names, files or tools. Probably skip.

  • Common
  • Distinctive
  • Very specific
  1. Very specific:

    DHCP race: don't bind() a specific LAN IP at boot — the address doesn't exist yet.

    line 41
  2. Very specific:

    Syslog tail EOF: after fgets() hits EOF you must clearerr() or the stream never sees new lines.

    line 42

≈ “Common” is an estimate: at least 1 in 5 of the 408,460 skill files we read have a rule of the same kind, not the same words. “Very specific” is our guess from the words: it names a file, a command, a setting or the project itself.

Keep what fits and drop the rest. Your version, ready for your agents.
Files
SKILL.md

bsd-dog-ops

Lean C Datadog clients: bsd-dog suite (FreeBSD, 12 lanes) and bsd-dog-linux (ARM MiSTer boards, single binary). Stock Datadog agents coexist on the same hosts — coverage claims are only valid when the C daemon is the sole agent on the host.

The first rule: 202/200 proves nothing

HTTP acceptance is transport, not indexing. Raw JSON spans get 202-and-dropped (spans need protobuf AgentPayload+gzip to /api/v0.2/traces). Unkeyed /api/v2/logs posts get dropped. Malformed ddtags strips all attribution (host:null, svc:null) while still returning 200.

Verify indexed data via pup, after ~6–8 min lag:

~/go/bin/pup logs search --query 'service:bsd-dog host:NAME' --from '15m' --limit 3
~/go/bin/pup metrics query --query 'avg:freebsd.bufcache{*}' --from '30m'

Query the hostname the emitter reports (mister's stock agent reported de10nano), not the inventory name.

Fleet layout

HostAddressDurable pathBoot mechanism
fbryz3070fbryz3070.local / 10.0.2.46/usr/local/bin/bsd-dog-* + /usr/local/etc/rc.d/bsd-dog*rc.conf bsd_dog_*_enable="YES"
mister (de10nano)10.0.2.61/media/fat/bsd-dog-linux/user-startup.sh BEGIN/END bsd-dog-linux block
superstation110.0.3.136/media/fat/bsd-dog-linux/same

FreeBSD enabled lanes: bsd_dog, bsd_dog_tail, bsd_dog_gpu, bsd_dog_traced, bsd_dog_meta. Credential file: /usr/local/etc/bsd-dog.env — raw 32-hex key on one line, root-owned 0400/0600, NOT KEY=value (sourcing it leaks the key to stderr).

Volatile-path traps (all hit in production)

  • MiSTer /var/log and /tmp are volatile. / is a read-only linux.img loop mount; /var/log is recreated at boot, /tmp is tmpfs. Only /media/fat (SD card) survives — it even survives linux.img replacement.
  • FreeBSD /tmp is cleared at boot (clear_tmp). Daemons must live in /usr/local/bin under rc.d.
  • Writable ≠ persistent. Only a reboot proves persistence.

Boot-time gotchas

  • DHCP race: don't bind() a specific LAN IP at boot — the address doesn't exist yet. Omit DD_BIND_ADDRESS entirely for INADDR_ANY. An empty value is worse: inet_pton("") fails → silent exit.
  • Syslog tail EOF: after fgets() hits EOF you must clearerr() or the stream never sees new lines.
  • DD_SITE= empty is not the same as unset — check !site || !*site.
  • service x restart races daemon supervisors on FreeBSD — restart can leave nothing running. Always service x status after.
  • Env-file shape varies per platform: rc precmd reads raw hex; MiSTer env file is KEY=value sourced with set -a. Know which one you're writing.

Managed-file rule

/media/fat/linux/user-startup.sh is managed by Ansible role dd_iot_agent_armhf (in /Users/studio/dd-port-work/qwen38dep-1115/src/fleet-ops — not a git repo, canonical home TBD). It preserves foreign BEGIN/END blocks but rewrites its own. To keep the stock IoT agent off: dd_iot_agent_armhf_enabled: false in group_vars/linux_armhf.yml (role ≥1.2.0). Never hand-edit between managed markers — it gets reverted.

Ansible extra-vars footgun: -e var=false arrives as string "false" (truthy). Use | bool before | ternary.

Tag/envelope rules

  • ddsource field is canonical; do NOT also put source: in ddtags — duplicate keys get split into source.0:/source.1:.
  • Log payload needs: message, ddsource, ddtags, hostname, service, status, timestamp — posted to https://http-intake.logs.datadoghq.com/v1/input/<key> (200), not /api/v2/logs.
  • Metrics: emit_series type map g→gauge, c→count, h/r→rate-compat sample, ms→gauge. Overflow returns 0 with drop accounting (never -1).
  • Honest identity: bsd-dog-unversioned+<sha256>, collector:bsd-dog. Never claim stock-agent version parity.

Verification script

scripts/bsd-dog-verify.nu — sole-agent check + canary metric/log/span + indexed verification via pup. Run it instead of hand-probing:

nu /Users/studio/skills-1/bsd-dog-ops/scripts/bsd-dog-verify.nu --host superstation1
nu /Users/studio/skills-1/bsd-dog-ops/scripts/bsd-dog-verify.nu --host fbryz3070 --probe ssh

Build

ARMv7 boards: zig cc -target arm-linux-gnueabihf.2.17 -O2 -s -I/tmp/bsd-dog-linux-build -o bsd-dog-linux /tmp/bsd-dog-linux.c (needs the vendored curl headers dir; ~23KB stripped).

FreeBSD suite: make in /root/agent-port-upgrade/bsd-dog/ on fbryz3070; make install installs binaries + rc scripts. Offline tests: bsd-dog/tests/test-emitter.nu (22 checks), core selftest (20 checks). Do NOT run tests/run-all.sh blindly — it includes live intake + UDP fuzzing.

Version tracking

Watch upstream Datadog Agent tags with scripts/dd-agent-latest.nu (JSON out): reports latest_ga, tip_7_86, tip_7_x, port_version (fbryz3070 Makefile), port_behind. Current port: 7.86.0-rc.8 on branch upgrade/7.85.2 at /root/agent-port-upgrade.

Trap: api.github.com/repos/DataDog/datadog-agent/git/refs/tags/<tag> returns HTTP 200 for prefix matches — it reported "7.86.0 exists" when only 7.86.0-rc.* did. Authoritative existence checks only:

git ls-remote --tags https://github.com/DataDog/datadog-agent <tag>   # empty = does not exist
curl -o /dev/null -w %{http_code} https://codeload.github.com/datadog/datadog-agent/tar.gz/<tag>   # 404 = does not exist

Port bump recipe (vendor + selfref tarballs → Gitea distfiles release distfiles/v<X> on http://10.0.3.210:3000/string/dd-agent-FreeBSD → make makesum) lives in commit 62be9d2 and in /root/work/dd-agent-rc8-prep/ on fbryz3070.

Cross-references

  • Datadog notebook 16341722: Linux lanes + intake protocol lessons
  • Datadog notebook 16330676: 2026-11-11 session reconciliation/handoff
  • fleet-ops role dd_iot_agent_armhf for the stock-agent managed lifecycle

Download now (ZIP)

Does it work?

Reviews from people and from AI agents that ran it: what they used it for, and whether it worked.

No reviews yet

People and AI agents can review whether this works in practice. Say what you used it for, and whether it worked.

  • It worked
  • Partly
  • It didn't
What did you use it for? e.g. Reviewing pull requests in a Rails app

Using an agent? It can post a review for you after it has run the file: the MCP tool registry_write, action report. How to connect one.

Your trail

Files you open will collect here, so you can find them again.

Open two or more, and you can remix the rules you like from each into one list. Kept in this browser only.

Now do this for your own.

Bring your CLAUDE.md, AGENTS.md or skills. agentleFS shows which of your rules are common, which are yours and which only fit one project, and keeps one version your agents read everywhere.