背景。
我有 IBM CDC Replication 引擎,我需要使用 Zabbix 检查订阅状态。
cmd.exe /C "C:\Program Files\IBM\InfoSphere Data Replication\Management Console\bin\chcclp.exe" -f c:\CDC_Check.txt
我通过CDC_Check.txt 是该 chcclp CLI 的脚本来调用 subs 状态
//Check the status of all subscriptions
//Source datastore: ***
//Target datastore: ***
chcclp session set to cdc;
// Turn on verbose output.
set verbose;
// Setting variables.
set variable name "ACCESS_HOSTNAME" value "";
set variable name "ACCESS_PORT" value "";
set variable name "ACCESS_USERNAME" value "";
set variable name "ACCESS_PASSWORD" value "";
set variable name "SOURCE_DATASTORE" value "";
set variable name "TARGET_DATASTORE" value "";
// Connecting to Access Server.
connect server
hostname "%ACCESS_HOSTNAME%"
port "%ACCESS_PORT%"
username "%ACCESS_USERNAME%"
password "%ACCESS_PASSWORD%";
// Connecting to the source and target datastores.
connect datastore name "%SOURCE_DATASTORE%";
connect datastore name "%TARGET_DATASTORE%";
// Setting the datastore context.
select datastore name "%SOURCE_DATASTORE%" context source;
select datastore name "%TARGET_DATASTORE%" context target;
// List replication state and latency of all subscriptions.
monitor replication;
// Disconnecting from datastores and Access Server.
disconnect datastore name "%SOURCE_DATASTORE%";
disconnect datastore name "%TARGET_DATASTORE%";
// Disconnect from Access Server and terminate the script.
disconnect server;
exit;
我正在尝试解析订阅 + 状态并将其移动到 Json 以便与 zabbix 进行下一次集成。我在 PS 方面很新,所以我仍然没有正常的进步。我理解我需要捕获任何在 SUBSCRIPTIONS 和 STATE 下的内容并将其写入 Json 的想法。