OCP V4.2.1 支持了 OBLB & OBDNS 的告警能力,共 16 个告警指标,如进程状态、进程连通性等,从而实现 OceanBase 整个架构体系的告警能力。要实现对 OBLB 的监控功能,首先需要为对应服务器添加 OBLB 标签。同时 OAT V4.2.0 实现了为 OBLB 服务器自动添加 OBLB 标签的功能,在为服务器添加标签时,您需满足以下条件:
OCP 为 V4.2.1 及以上版本。
OAT 为 V4.2.0 及以上版本,且在正常运行中。
OBLB 为 V1.4.0 以上版本。
OBLB 工具需通过 OAT 进行部署,并在部署时打开 同步至 OCP 监控告警 开关。

当您的运行环境不满足以上任一条件时,将无法通过 OAT 自动为服务器添加 OBLB 标签。此时您可通过 OCP 开放的 API 接口,手动为服务器添加、删除 OBLB 标签。
适用版本
适用于 OceanBase 云平台(OceanBase Cloud Platform,OCP)V4.2.1 及以上版本。
前提条件
待添加 OBLB 标签的服务器,已通过 添加主机 的方式接管至 OCP 平台。
操作步骤
为服务器添加 OBLB 标签
使用 MySQL/OBClient 客户端工具连接 OCP Meta 数据库,根据服务器的 IP 地址查询对应的
host_id:[root@ocp147 ~]# mysql -hxxx.xxx.xxx.xxx -uroot@ocp_meta -P2881 -pxxx Welcome to the MariaDB monitor. Commands end with ; or \g. Your MySQL connection id is 3221503749 Server version: 5.7.25 OceanBase 2.2.77 (r117030032023091117-fafe782c53fc2eb70a482e7c0936d5ebfe1ca8a0) (Built Sep 11 2023 19:02:36) Copyright (c) 2000, 2018, Oracle, MariaDB Corporation Ab and others. Type 'help;' or '\h' for help. Type '\c' to clear the current input statement. MySQL [(none)]> use ocp; Reading table information for completion of table and column names You can turn off this feature to get a quicker startup with -A Database changed MySQL [ocp]> select * from compute_host where inner_ip_address='xxx.xxx.xxx.xxx'\G *************************** 1. row *************************** id: 7000001 name: oms-119 description: NULL operating_system: 5.10.0-136.12.0.86.oe2203sp1.x86_64 architecture: x86_64 inner_ip_address: xxx.xxx.xxx.xxx ssh_port: 22 kind: DEDICATED_PHYSICAL_MACHINE publish_ports: NULL status: AVAILABLE vpc_id: 1 idc_id: 1 host_type_id: 1000001 serial_number: NULL alias: ob119 create_time: 2024-01-29 17:21:40 update_time: 2024-05-07 10:17:21 io_performance: NULL 1 row in set (0.001 sec)通过 OCP 开放的 API 接口,为该服务器添加 OBLB 标签:
[root@ocp ~]# curl -uadmin:xxx 'http://xxx.xxx.xxx.xxx:8080/api/v2/compute/monitorTargets/batchCreate' \ > --header 'Content-Type: application/json' \ > --data '{ > "serviceType": "OBLB", > "serviceName": "oblb_service", > "hostMonitorInfos": [ > { > "hostId": 7000001, > "monitorInfo": { > "OBLB_SERVER": "9090", > "OBLB_ETCD": "2379" > } > } > ] > }' {"duration":268,"server":"45b956df2a","status":200,"successful":true,"timestamp":"2024-05-07T10:34:35.355+08:00","traceId":"74959cdc29584dbb"}说明
OBLB_SERVER为安装 OBLB 服务时用户自定义的 OBLB 服务端口。OBLB_ETCD为安装 OBLB 服务时用户指定的etcd client端口,默认为2379。
登录 OCP,查看主机信息。
添加标签前,主机标签为空:

添加标签后,主机标签为 OBLB:

为服务器删除 OBLB 标签
通过 MySQL/OBClient 客户端工具连接 OCP Meta 数据库,根据服务器的 IP 地址查询对应的
host_id、OBLB 服务的type、OBLB 服务的name:[root@ocp ~]# mysql -hxxx.xxx.xxx.xxx -uroot@ocp_meta -P2881 -pxxx Welcome to the MariaDB monitor. Commands end with ; or \g. Your MySQL connection id is 3221690267 Server version: 5.7.25 OceanBase 2.2.77 (r117030032023091117-fafe782c53fc2eb70a482e7c0936d5ebfe1ca8a0) (Built Sep 11 2023 19:02:36) Copyright (c) 2000, 2018, Oracle, MariaDB Corporation Ab and others. Type 'help;' or '\h' for help. Type '\c' to clear the current input statement. MySQL [(none)]> use ocp; Reading table information for completion of table and column names You can turn off this feature to get a quicker startup with -A Database changed MySQL [ocp]> select * from compute_host where inner_ip_address='xxx.xxx.xxx.xxx'\G *************************** 1. row *************************** id: 7000001 name: oms-119 description: NULL operating_system: 5.10.0-136.12.0.86.oe2203sp1.x86_64 architecture: x86_64 inner_ip_address: xxx.xxx.xxx.xxx ssh_port: 22 kind: DEDICATED_PHYSICAL_MACHINE publish_ports: NULL status: ONLINE vpc_id: 1 idc_id: 1 host_type_id: 1000001 serial_number: NULL alias: ob119 create_time: 2024-01-29 17:21:40 update_time: 2024-05-07 00:19:03 io_performance: NULL 1 row in set (0.001 sec) MySQL [ocp]> select * from compute_host_service where host_id=7000001\G *************************** 1. row *************************** id: 18000001 host_id: 7000001 <== 对应服务器的 host_id type: OBLB <== OBLB 服务的 type name: oblb_service <== OBLB 服务的 name version: NULL software_package_id: NULL create_time: 2024-04-15 17:22:43 update_time: 2024-04-15 17:22:43 1 row in set (0.002 sec)通过 OCP 开放的 API 接口,删除该服务器上的 OBLB 标签:
[root@ocp ~]# curl -uadmin:xxx 'http://xxx.xxx.xxx.xxx:8080/api/v2/compute/monitorTargets/batchDelete' \ --header 'Content-Type: application/json' \ --data '{ "hostIds": [7000001], "serviceType": "OBLB", "serviceName": "oblb_service" }' {"duration":181,"server":"45b956df2a","status":200,"successful":true,"timestamp":"2024-05-07T10:17:21.456+08:00","traceId":"d7ed252428634a07"}登录 OCP,查看主机信息。
删除标签前,主机标签为 OBLB:

删除标签后,主机标签为空:
