How to do monitoring for the Bamboo Data Center remote agents
プラットフォームについて: Data Center - この記事は、Data Center プラットフォームのアトラシアン製品に適用されます。
このナレッジベース記事は製品の Data Center バージョン用に作成されています。Data Center 固有ではない機能の Data Center ナレッジベースは、製品のサーバー バージョンでも動作する可能性はありますが、テストは行われていません。サーバー*製品のサポートは 2024 年 2 月 15 日に終了しました。サーバー製品を利用している場合は、アトラシアンのサーバー製品のサポート終了のお知らせページにて移行オプションをご確認ください。
*Fisheye および Crucible は除く
要約
If you are looking to monitor your remote agents and their status apart from viewing Bamboo's agents in UI you can utilize the Bamboo REST API, which provides a programmatic way to access information about agent statuses.
環境
Bamboo 9+
ソリューション
You can make use of Bamboo REST API to monitor agents. And combine the API endpoints in a script parse the output for monitoring statues.
- You can use the REST API endpoint
/rest/api/latest/agent/remote
to retrieve a list of all remote agents and their authentication statuses. - This endpoint provides detailed information about each agent, including its ID, name, type, and status indicators such as whether it is active, enabled, or busy.
$curl -uadmin -H "Accept: application/json" http://localhost:8928/b928/rest/api/latest/agent/remote | jq
Enter host password for user 'admin':
% Total % Received % Xferd Average Speed Time Time Time Current
Dload Upload Total Spent Left Speed
100 131 0 131 0 0 1033 0 --:--:-- --:--:-- --:--:-- 1031
[
{
"id": 3833857,
"name": "ip-192-168-0-16.ap-southeast-2.compute.internal",
"type": "REMOTE",
"active": true,
"enabled": true,
"busy": false
}
]
The above output values explained:
- "id" is the unique identifier of the agent.
- "name" is the hostname or identifier of the agent machine.
- "type" indicates the type of agent, which is "REMOTE" in this case.
- "active" shows whether the agent is currently active.
- "enabled" indicates if the agent is enabled and available for use.
- "busy" reflects whether the agent is currently executing a job.
You can also manage agents through the Bamboo REST API. For example, you can delete an agent by using the appropriate API endpoint.
For more details and a comprehensive list of available operations, refer to the Bamboo REST API documentation:https://developer.atlassian.com/server/bamboo/rest/api-group-api/#api-api-latest-agent-agentid-delete.