How to fetch Bamboo agent utilization reports for build plans and deployments using database queries
Platform notice: Server and Data Center only. This article only applies to Atlassian products on the Server and Data Center platforms.
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
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!
Summary
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 performing any modifications to the database. 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):
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):
SELECT Q.AGENT_TYPE,
Q.TITLE,
DR.VERSION_NAME,
DR.ENVIRONMENT_ID,
DR.FINISHED_DATE
FROM QUEUE Q
LEFT JOIN DEPLOYMENT_RESULT DR
ON Q.QUEUE_ID = DR.AGENT_ID
ORDER BY Q.AGENT_TYPE,
Q.TITLE