OPCUA服务器可以在RootFolder.Server.ServerDiagnostics节点下公开此类信息,您需要的信息应可通过OPCUA访问。
这个小节点操作客户端程序将向您展示如何做。
注意:
某些数据(例如安全诊断程序)需要安全连接和非匿名用户
client_extract_server_diagnostic.ts
// this script is typescript and can be run this way
// $ npx ts-node client_extract_server_diagnostic.ts
import {
AttributeIds,
OPCUAClient,
ClientSession,
StatusCodes,
MessageSecurityMode,
SecurityPolicy,
UserIdentityInfoUserName,
UserTokenType
} from "node-opcua";
// the opcua server to connect to
const endpointUrl = "opc.tcp://localhost:48010";
// the credential
const userIdentityToken: UserIdentityInfoUserName = {
password: "secret",
userName: "root",
type: UserTokenType.UserName
};
async functio