feat: 新增设备巡检模块实现完整的巡检告警功能
新增设备巡检模块核心功能,包括: - 巡检数据存储与调度系统 - 华为/H3C交换机及Linux服务器采集器 - 设备扩展配置与告警规则管理 - 主机详情页巡检配置入口 - 产品名称自定义设置功能 - 网络设备SSH exec通道兼容处理
This commit is contained in:
@@ -40,6 +40,26 @@ function openBoundedSshExecStream(
|
||||
if (!sshClient || typeof sshClient.exec !== "function") {
|
||||
return Promise.reject(new Error("SSH exec unavailable"));
|
||||
}
|
||||
// [NETWORK-DEVICE GATE] H3C / Huawei VRP / Comware / Cisco etc. only allow
|
||||
// one SSH channel per transport. Opening an exec channel on the same conn
|
||||
// drops the user's interactive shell outright. Detect from the SSH banner
|
||||
// stored on the ssh2 Client and bail out early.
|
||||
const _v = typeof sshClient._remoteVer === "string" ? sshClient._remoteVer : "";
|
||||
if (
|
||||
/^H3C[-_\s]/i.test(_v)
|
||||
|| /^Comware-/i.test(_v)
|
||||
|| /^HUAWEI[-_]/i.test(_v)
|
||||
|| /^VRP-/i.test(_v)
|
||||
|| _v === "-"
|
||||
|| /^Cisco[-_]|^CiscoIOS_/i.test(_v)
|
||||
|| /^RGOS_SSH/i.test(_v)
|
||||
|| /^JUNOS/i.test(_v)
|
||||
) {
|
||||
return Promise.reject(Object.assign(
|
||||
new Error("SSH exec channel not supported on network device (vendor CLI only allows one channel per connection)"),
|
||||
{ code: "SSH_EXEC_NOT_SUPPORTED" },
|
||||
));
|
||||
}
|
||||
const signal = options.signal || null;
|
||||
const setTimeoutFn = options.setTimeoutFn || setTimeout;
|
||||
const clearTimeoutFn = options.clearTimeoutFn || clearTimeout;
|
||||
|
||||
Reference in New Issue
Block a user