mirror of
https://github.com/hansjone/oclaw.git
synced 2026-10-16 21:40:49 +08:00
fix(chat): honor ui_lang on WebSocket turns; ops NE display by host_name
Resolve runtime language from ui_lang and chat.send lang instead of hardcoding zh. Align generalist/ops prompts with user language and require host_name (not ne_id) in ops outputs. Co-authored-by: Cursor <cursoragent@cursor.com>
This commit is contained in:
parent
3a467704d6
commit
f1626195f7
12 changed files with 86 additions and 27 deletions
|
|
@ -74,9 +74,19 @@ description: 面向 ops 专家的 netx UME 运维作业手册。覆盖告警查
|
|||
- 可执行下一步
|
||||
- 没有工具证据时,不得臆测告警事实。
|
||||
|
||||
### 网元名称(强制)
|
||||
|
||||
- 凡涉及网元,用户可见文本一律用 **网元名称** = 网元表 `host_name`(告警 raw:`ne_host_name`;清单/`netx_get_ume_ne`:`host_name`)。
|
||||
- **禁止**在表格、结论、Top 列表里写裸 `ne_id`(UUID)。
|
||||
- 仅有 `ne_id` 时必须先解析名称,再输出:
|
||||
1. 少量 ID:`netx_get_ume_ne` 逐条取 `host_name`;
|
||||
2. 多条 / 统计:`netx_query_ume_ne_inventory` 分页,或 `netx_sql_query_ume` 中 `JOIN ume_inventory_ne ne ON ne.ne_id = …` 选出 `ne.host_name`;
|
||||
3. 原始告警证据:`netx_query_ume_alarms_raw` 的 `select_fields` 或 `field_preset` 须含 `ne_host_name`(勿只取 `alarm_ne_id`)。
|
||||
- `host_name` 为空时可用 `user_label` / `ne_name` 作显示后备,并标注缺失;仍不得用 `ne_id` 顶替。
|
||||
|
||||
## 推荐分析模式
|
||||
|
||||
- 高风险网元:`netx_aggregate_ume_alarms_raw` + `group_by=ne_user_label` + 严重度过滤。
|
||||
- 高风险网元:`netx_aggregate_ume_alarms_raw` + `group_by=ne_host_name`(勿按 `alarm_ne_id` / `ne_ne_id` 分组对外展示)+ 严重度过滤。
|
||||
- 严重度分布:`group_by=alarm_perceived_severity`。
|
||||
- 事件趋势切片:raw 查询中组合 `time_from/time_to` + `event_type`。
|
||||
|
||||
|
|
|
|||
|
|
@ -23,18 +23,20 @@
|
|||
- `alarm_alarm_key`
|
||||
- `alarm_perceived_severity`
|
||||
- `alarm_last_seen_at`
|
||||
- `ne_host_name`(网元名称,对外展示首选)
|
||||
- `ne_user_label`
|
||||
- `ne_ip_address`
|
||||
- **禁止**在用户可见输出中只列 `alarm_ne_id`;需要网元身份时必须带 `ne_host_name` 或先联查网元表。
|
||||
|
||||
## 3) 动态聚合(非 SQL)
|
||||
|
||||
- 工具:`netx_aggregate_ume_alarms_raw`
|
||||
- 常用分组:
|
||||
- `group_by=alarm_perceived_severity`
|
||||
- `group_by=ne_user_label`
|
||||
- `group_by=ne_host_name`(网元名称;勿用 `alarm_ne_id` / `ne_ne_id` 作对外维度)
|
||||
- `group_by=alarm_event_type`
|
||||
- `group_by=ne_connection_status`
|
||||
- `group_by=alarm_perceived_severity, group_by2=ne_user_label`
|
||||
- `group_by=alarm_perceived_severity, group_by2=ne_host_name`
|
||||
- 建议:
|
||||
- 推荐 `limit=200`
|
||||
|
||||
|
|
@ -62,11 +64,11 @@
|
|||
- 示例(全量聚合,谨慎使用):
|
||||
```sql
|
||||
select
|
||||
coalesce(ne.user_label, ne.ne_name, a.ne_id) as ne_display,
|
||||
coalesce(nullif(trim(ne.host_name), ''), ne.user_label, ne.ne_name, '(host_name missing)') as ne_name,
|
||||
count(*) as alarm_count
|
||||
from ume_alarms_current a
|
||||
left join ume_inventory_ne ne on ne.ne_id = a.ne_id
|
||||
group by coalesce(ne.user_label, ne.ne_name, a.ne_id)
|
||||
group by coalesce(nullif(trim(ne.host_name), ''), ne.user_label, ne.ne_name, '(host_name missing)')
|
||||
order by alarm_count desc
|
||||
```
|
||||
|
||||
|
|
@ -74,12 +76,12 @@ order by alarm_count desc
|
|||
- `statement_timeout_ms=8000`
|
||||
```sql
|
||||
select
|
||||
coalesce(ne.user_label, ne.ne_name, a.ne_id) as ne_display,
|
||||
coalesce(nullif(trim(ne.host_name), ''), ne.user_label, ne.ne_name, '(host_name missing)') as ne_name,
|
||||
count(*) as alarm_count
|
||||
from ume_alarms_current a
|
||||
left join ume_inventory_ne ne on ne.ne_id = a.ne_id
|
||||
where a.last_seen_at >= now() - interval '30 minutes'
|
||||
group by coalesce(ne.user_label, ne.ne_name, a.ne_id)
|
||||
group by coalesce(nullif(trim(ne.host_name), ''), ne.user_label, ne.ne_name, '(host_name missing)')
|
||||
order by alarm_count desc
|
||||
```
|
||||
|
||||
|
|
@ -87,12 +89,12 @@ order by alarm_count desc
|
|||
- `statement_timeout_ms=8000`
|
||||
```sql
|
||||
select
|
||||
coalesce(ne.user_label, ne.ne_name, a.ne_id) as ne_display,
|
||||
coalesce(nullif(trim(ne.host_name), ''), ne.user_label, ne.ne_name, '(host_name missing)') as ne_name,
|
||||
count(*) as alarm_count
|
||||
from ume_alarms_current a
|
||||
left join ume_inventory_ne ne on ne.ne_id = a.ne_id
|
||||
where a.last_seen_at >= now() - interval '30 minutes'
|
||||
and lower(coalesce(a.perceived_severity, '')) in ('critical','major')
|
||||
group by coalesce(ne.user_label, ne.ne_name, a.ne_id)
|
||||
group by coalesce(nullif(trim(ne.host_name), ''), ne.user_label, ne.ne_name, '(host_name missing)')
|
||||
order by alarm_count desc
|
||||
```
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue