集群
获取集群信息
curl -u 'admin:xxxx' http://<ip or hostname>:<port>/api/v1/clusters
"Clusters" : {
"cluster_name" : "xxxxxx-xxxx"
}
获取集群所有信息
- /api/v1/clusters/{$cluster_name}
curl -u 'admin:xxxx' http://<ip or hostname>:<port>/api/v1/clusters/{$cluster_name}
主机
获取集群下的所有机器
- /api/v1/clusters/{$cluster_name}/hosts
curl -u 'admin:xxxx' http://<ip or hostname>:<port>//api/v1/clusters/{$cluster_name}/hosts
"Hosts" : {
"cluster_name" : "xxxxxx-xxxx",
"host_name" : "core-xxxx"
}
获取机器的详细信息
- /api/v1/clusters/{$cluster_name}/hosts/{$host_name}
curl -u 'admin:xxxx' http://<ip or hostname>:<port>//api/v1/clusters/{$cluster_name}/hosts/{$host_name}
Hosts 基本信息
alerts_summary 告警概览
metrics 指标
kerberos_identities kerberos信息
alerts 告警详情
stack_versions 软件栈版本
host_components 机器组件
- /api/v1/clusters/{$cluster_name}/hosts/{$host_name}?fields={$item}
curl -u 'admin:xxxx' http://<ip or hostname>:<port>/api/v1/clusters/{$cluster_name}/hosts/{$host_name}?fields={$item}
curl -u 'admin:xxxx' http://<ip or hostname>:<port>/api/v1/clusters/{$cluster_name}/hosts/{$host_name}?fields=Hosts
配置 描述
Hosts/host_name 主机名
Hosts/ip 主机ip地址
Hosts/total_mem 主机上可用总内存
Hosts/cpu_count 主机cpu数量
Hosts/os_arch 主机的操作系统架构(例如x86_64)
Hosts/os_type 主机的操作系统类型(例如 centos 6)
Hosts/disk_info 主机磁盘信息
Hosts/host_status 主机状态(未知,健康,不健康)
Hosts/host_state 主机状态
主机状态 描述
INIT 初始化主机状态
WAITING_FOR_HOST_STATUS_UPDATES 等待主机更新状态
HEALTHY 主机状态正常
HEARTBEAT_LOST 主机心跳丢失
UNHEALTHY 不健康状态
curl -u 'admin:xxxx' http://<ip or hostname>:<port>/api/v1/clusters/{$cluster_name}/hosts/{$host_name}?fields=Hosts/disk_info
服务
获取集群所有服务
- /api/v1/clusters/{$cluster_name}/services
curl -u 'admin:xxxx' http://<ip or hostname>:<port>/api/v1/clusters/{$cluster_name}/services
"ServiceInfo" : {
"cluster_name" : "xxxxxx-xxxx",
"service_name" : "YARN"
}
获取服务详情
- /api/v1/clusters/{$cluster_name}/services/{$service_name}
curl -u 'admin:xxxx' http://<ip or hostname>:<port>/api/v1/clusters/{$cluster_name}/services/{$service_name}
ServiceInfo 基本信息
alerts_summary 告警概览
alerts 告警信息
components 组件信息
- /api/v1/clusters/{$cluster_name}/services/{$service_name}?fields={$item}
curl -u 'admin:xxxx' http://<ip or hostname>:<port>/api/v1/clusters/{$cluster_name}/services/{$service_name}?fields={$item}
curl -u 'admin:xxxx' http://<ip or hostname>:<port>/api/v1/clusters/{$cluster_name}/services/{$service_name}?fields=ServiceInfo
ServiceInfo/state 服务当前状态
状态 描述
INIT 初始状态
INSTALLING 服务安装中
INSTALL_FAILED 服务安装失败
INSTALLED 服务已安装
STARTING 服务启动中
STARTED 服务已启动
STOPPING 服务停止中
UNINSTALLING 服务卸载中
UNINSTALLED 服务已卸载
WIPING_OUT 已安装服务清除中
UPGRADING 服务升级中
MAINTENANCE 服务处于维护状态
UNKNOWN 无法确定服务状态
curl -u 'admin:xxxx' http://<ip or hostname>:<port>/api/v1/clusters/{$cluster_name}/services/{$service_name}/alerts
或
curl -u 'admin:xxxx' http://<ip or hostname>:<port>/api/v1/clusters/{$cluster_name}/services/{$service_name}?fields=alerts
"Alert" : {
"cluster_name" : "xxxxxx-xxxx",
"create_time" : null,
"create_user" : null,
"definition_id" : 34,
"definition_name" : "yarn_nodemanager_webui",
"host_name" : "core-xxxx",
"id" : 62,
"service_name" : "YARN"
}
curl -u 'admin:xxxx' http://<ip or hostname>:<port>/api/v1/clusters/{$cluster_name}/services/{$service_name}/alerts/{$id}