Install
openclaw skills install huawei-device-inspector通过SSH自动巡检华为交换机和路由器,执行状态检查、告警和安全风险排查,生成详细健康报告。
openclaw skills install huawei-device-inspector通过SSH连接华为交换机/路由器,自动执行状态检查、告警查询、安全风险排查,生成巡检报告。
使用pexpect建立交互式SSH连接(华为设备直接SSH会被断开):
import pexpect
def connect_device(host, username, password):
child = pexpect.spawn(f'ssh -o StrictHostKeyChecking=no {username}@{host}', timeout=60)
child.expect(['password:', 'Password:'], timeout=10)
child.sendline(password)
child.expect(['>', '#'], timeout=15)
return child
按顺序执行以下命令收集信息:
| 命令 | 用途 |
|---|---|
display version | 系统版本、运行时间 |
display device | 硬件状态 |
display cpu-usage | CPU使用率 |
display memory-usage | 内存使用率 |
display alarm active | 活动告警 |
display temperature all | 温度状态 |
display power | 电源状态 |
display fan | 风扇状态 |
display anti-attack statistics | 攻击防御统计 |
重点关注以下告警类型:
| 告警名称 | 级别 | 说明 |
|---|---|---|
| hwSysSecureRiskWarning | Warning | 安全风险警告 |
| hwGtlDefaultValue | Major | License未激活 |
| hwLdtPortLoopDetect | Warning | 端口环路检测 |
| linkDown | Critical | 接口断开 |
报告包含:
## 华为 [型号] 巡检报告
### 基本信息
| 项目 | 状态 |
|------|------|
| 型号 | xxx |
| 系统版本 | xxx |
| 运行时间 | xxx |
### 硬件状态
| 组件 | 状态 |
|------|------|
| 主控板 | Normal |
| 电源 | Normal |
| 风扇 | Normal |
| 温度 | xx°C |
### 资源使用
| 指标 | 当前值 | 状态 |
|------|--------|------|
| CPU | xx% | ✅/⚠️ |
| 内存 | xx% | ✅/⚠️ |
### 活动告警
| 级别 | 告警 | 说明 |
|------|------|------|
| Warning | xxx | xxx |
### 问题总结
1. xxx
2. xxx
---- More ----),需要发送空格继续