本节为您介绍如何使用Connection
对象的方法检查数据库服务器统计信息。
stats()
获取数据库服务器的统计信息。
参数:
RequestConfig
(可选):请求配置。
返回值:
Stats
:获取到的服务器统计信息。
from ultipa import Connection, UltipaConfig
ultipaConfig = UltipaConfig()
# URI 示例: ultipaConfig.hosts = ["mqj4zouys.us-east-1.cloud.ultipa.com:60010"]
ultipaConfig.hosts = ["192.168.1.85:60061", "192.168.1.87:60061", "192.168.1.88:60061"]
ultipaConfig.username = "<username>"
ultipaConfig.password = "<password>"
Conn = Connection.NewConnection(defaultConfig=ultipaConfig)
# 服务器信息
stats = Conn.stats()
print("CPU usage (%): " + stats.cpuUsage)
print("Memory usage (MB): " + stats.memUsage)
print("Expiration date: " + stats.expiredDate)
print("CPU cores: " + stats.cpuCores)
print("Company: " + stats.company)
print("Server type: " + stats.serverType)
print("Version: " + stats.version)
CPU usage (%): 116.560783
Memory usage (MB): 11924.585938
Expiration date: Thu Dec 26 23:59:59 2024
CPU cores: 80
Company: ultipa
Server type: CT
Version: htap_beta.4.5.7-b4.5.0-tv-ui