How to fetch Bamboo agent utilization reports for build plans and deployments using database queries
Platform Notice: Data Center Only - This article only applies to Atlassian products on the Data Center platform.
Note that this KB was created for the Data Center version of the product. Data Center KBs for non-Data-Center-specific features may also work for Server versions of the product, however they have not been tested. Support for Server* products ended on February 15th 2024. If you are running a Server product, you can visit the Atlassian Server end of support announcement to review your migration options.
*Except Fisheye and Crucible
Summary
The steps outlined on this article are provided AS-IS. This means we've had reports of them working for some customers — under certain circumstances — yet are not officially supported, nor can we guarantee they'll work for your specific scenario.
You may follow through and validate them on your own non-prod environments prior to production or fall back to supported alternatives if they don't work out.
We also invite you to reach out to our Community for matters that fall beyond Atlassian's scope of support!
This article explains how to generate a list of plans and deployment projects alongside the agents responsible for building them from the database.
Environment
The SQL queries listed on this page have been tested on Bamboo 8.1.3 but may work with other versions of Bamboo as well.
Solution
Always back up your data before making any database modifications. If possible, test any alter, insert, update, or delete SQL commands on a staging server first.
The SQL queries listed in this article cover the following reports:
Agent utilization for builds plans
The following SQL query will generate a list of all build plans alongside the agent responsible for executing them (incl. completed date & time):
1
2
3
4
5
6
7
8
9
10
11
SELECT Q.AGENT_TYPE,
Q.TITLE,
BS.BUILD_KEY,
BS.PLAN_NAME,
BS.BUILD_COMPLETED_DATE
FROM QUEUE Q
LEFT JOIN BUILDRESULTSUMMARY BS
ON Q.QUEUE_ID = BS.BUILD_AGENT_ID
ORDER BY Q.AGENT_TYPE,
Q.TITLE,
BS.PLAN_NAME
Agent utilization report for deployment projects
The following SQL query will generate a list of all deployments alongside the agent responsible for executing them (incl. completed date & time):
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
SELECT Q.AGENT_TYPE,
Q.TITLE,
DR.VERSION_NAME,
DR.ENVIRONMENT_ID,
DP.NAME AS "DEPLOYMENT_PROJECT_NAME",
DE.NAME AS "DEPLOYMENT_ENVIRONMENT_NAME",
DR.FINISHED_DATE
FROM QUEUE Q
LEFT JOIN DEPLOYMENT_RESULT DR
ON Q.QUEUE_ID = DR.AGENT_ID
JOIN DEPLOYMENT_ENVIRONMENT DE
ON DR.ENVIRONMENT_ID = DE.ENVIRONMENT_ID
JOIN DEPLOYMENT_PROJECT DP
ON DE.PACKAGE_DEFINITION_ID = DP.DEPLOYMENT_PROJECT_ID
ORDER BY Q.AGENT_TYPE,
Q.TITLE
Was this helpful?