aiagent/skill/embedded/builtin/host-onboard-diagnose/SKILL.md
Enter this skill:
Do NOT enter this skill:
host-health-diagnosehost-ident-cleanup (to be built)creation / create-alert-rulealert-rule-troubleshootA missing host ≠ a single cause. The onboarding pipeline has 5 segments, and each segment getting stuck looks different. Looking at just one segment and telling the user to change config is a common pitfall. Gather evidence first, then localize segment by segment, and finally give fix commands.
[1] categraf local process Is it present / is the config correct / is heartbeat.enable on
│
[2] heartbeat report HTTP Can it reach /v1/n9e/heartbeat (network / TLS / BasicAuth)
│
[3] server / edge receive token / version compatibility / hostname duplicate check
│
[4] target table persistence Is this ident in the DB, is the meta in redis
│
[5] Redis + metric stream Can the time-series store find samples for this ident
probe_target_onboard_statusThis is the only diagnostic entry tool in this skill; it returns the footprint of all 5 segments in one shot. Always call it first, then decide the next step.
Key fields returned:
in_target_db + target.os + target.agent_version → evidence for segments 3/4in_redis_beat + redis_meta.hostname + redis_meta.remote_addr → evidence for segment 4in_prom_target_up + target_up_last + prom_metrics_hit → evidence for segment 5likely_segment + likely_causes → diagnosis already aggregated at the tool layer; do not bypass it and re-derive it yourselfIf the user did not provide an ident, first call list_targets and let the user pick, or filter out candidates by OS=unknown / empty agent_version (the "unassigned / partially onboarded" view).
| likely_segment | Meaning | Preferred fix action |
|---|---|---|
segment_1_or_2 | This host is in none of DB / redis / prom | On the target host: systemctl status categraf → journalctl -u categraf --since "5 min ago" → check whether it reports connection refused / x509 / 401 |
segment_3 | target exists but OS/agent_version empty | Check categraf's config.toml: [heartbeat] enable=true and omit_hostname=false; version ≥ v0.2.35 |
segment_4 | target persisted but no data in redis | Check whether n9e/edge has redis configured; in edge mode the [Redis] of edge.toml; whether n9e and n9e-edge versions are consistent |
segment_5 | redis has the beat but prom can't query it | Check whether categraf [[writers]] is configured; whether the datasource is correct in a multi-cluster deployment; whether the ident contains special characters like () [] * |
ok | Onboarding is normal | If the user still insists "I can't see it", guide them to refresh the page / check business-group filtering / check browser cache |
query_prometheus)When likely_segment=segment_5, you must run the following 3 queries with query_prometheus to confirm whether it is an ident label problem or truly no data:
# 1. Standard ident exact match (most common)
target_up{ident="<ident>"}
# 2. Fuzzy match (use when ident has an IP prefix / alias)
target_up{ident=~".*<host>.*"}
# 3. Extreme fallback: did it land on the instance label (snmp / custom tag scenario)
{instance=~".*<host>.*"}
All three return no data → the data stream truly never reached prom; go back and check categraf writers / TLS / n9e ingest queue.
Only (2) or (3) has data → ident label problem (special characters / global_labels override / snmp agent_host_tag misuse); guide the user to host-ident-cleanup (to be built) or to fix the categraf config.
The Final Answer uses Markdown, in the user's language. Four sections:
## Conclusion
<one sentence: stuck at segment X: xxxx (or: onboarding is normal, the reason you can't see it is yyy)>
## Onboarding Pipeline Evidence
- Segment 1/2 (categraf local/HTTP): <not gathered / inferred anomaly: xxx>
- Segment 3 (server receive): target in_db=true, os=unknown, agent_version="" → heartbeat metadata not persisted
- Segment 4 (target persistence + redis): target update_at=2026-05-14 10:23:11 but no heartbeat in redis
- Segment 5 (Prom): target_up has no data / prom_metrics_hit=0
## Fix Commands
1. Run on the target host:
`grep -E 'heartbeat|omit_hostname' /etc/categraf/conf/config.toml`
Expected: in the heartbeat section enable=true, omit_hostname=false. If either doesn't match, change it and `systemctl restart categraf`.
2. ...
3. ...
## Self-Verification Steps
<give the user 1-2 commands for "if you want to confirm it's fixed, you can verify like this", for example:
- Within 30s after restarting categraf, refresh the host list back in the platform; the OS/CPU fields should be non-unknown
- `curl -s http://<n9e>:17000/api/n9e/self-metrics | grep <ident>`>
heartbeat.enable directly without calling probe_target_onboard_status. Gather evidence first. Many users already have heartbeat enabled; the problem is in omit_hostname / TLS / version.in_target_db=false. You must look at the redis segment and the segment_1_or_2 causes to judge holistically whether it's a network problem or a process problem — the recommended actions are completely different.likely_segment=ok but the user insists the host doesn't appear, prompt them to check: business-group filtering (the host is present but hidden by business group in the frontend), browser cache, and the visible-business-group permissions of the logged-in user.