360 Secure SkillHub
360 安全技能中心

Ambari API

该 Skill 提供一个 Python 命令行脚本,封装 Ambari REST API:可保存多套集群连接配置,列出集群、服务、主机与组件,并对服务或指定主机上的组件执行 START/STOP/RESTART,以及查询服务详细状态,附带接口、示例与排障参考文档。

lukaizj
lukaizj
热度 37.08
最近更新 2026-05-11 17:45:06
分类:自动化依赖:代码执行 / 第三方 API / 读写文件应用场景:DevOps / 自动化脚本

安装技能

复制下面的话术发给你的 Agent,它会通过 secure-skills 检索并安装该技能。

执行命令安装此 skill: npx secure-skills-cli add lukaizj-ambari-api
Metadata
name
ambari-api
description
Manage Hadoop clusters via Ambari REST API. Supports service start/stop/restart, component operations, and cluster monitoring. Use when managing Ambari clusters, Hadoop services, or when user mentions Ambari, HDP, HDF, or cluster operations.

Ambari API Management

Manage Hadoop clusters through Ambari REST API (supports Ambari 2.7.5 and 3.0.0).

Quick Start

# Install dependencies
pip install -r ~/.claude/skills/ambari-api/scripts/requirements.txt

# Add cluster configuration
python ~/.claude/skills/ambari-api/scripts/ambari_api.py config --add \
  --name prod \
  --url https://ambari.example.com:8080 \
  --username admin \
  --password admin

# List clusters
python ~/.claude/skills/ambari-api/scripts/ambari_api.py clusters --config prod

Core Operations

Service Management

# List services in a cluster
python ambari_api.py services --config prod --cluster mycluster

# Start/Stop/Restart a service
python ambari_api.py services --config prod --cluster mycluster --service HDFS --action START
python ambari_api.py services --config prod --cluster mycluster --service YARN --action STOP
python ambari_api.py services --config prod --cluster mycluster --service HIVE --action RESTART

Component Management (Host-Specific)

# List components on a host
python ambari_api.py components --config prod --cluster mycluster --host node01

# Start/Stop specific component on a host
python ambari_api.py components --config prod --cluster mycluster --host node01 \
  --service HDFS --component DATANODE --action START

python ambari_api.py components --config prod --cluster mycluster --host node01 \
  --service HDFS --component DATANODE --action STOP

Host and Status Operations

# List all hosts
python ambari_api.py hosts --config prod --cluster mycluster

# Get service status
python ambari_api.py status --config prod --cluster mycluster --service HDFS

Configuration Management

# List configured clusters
python ambari_api.py config --list

# Remove a cluster configuration
python ambari_api.py config --remove --name prod

API Reference

Command Description
config --add Add cluster config with URL, username, password
config --list List all saved configurations
clusters List clusters in Ambari
services List services or perform START/STOP/RESTART
hosts List hosts in a cluster
components List or manage components on specific host
status Get detailed service status

References