How to fetch Bamboo Data Center Idle agent reports unused for build plans and deployments using database queries

Still need help?

The Atlassian Community is here for you.

Ask the community


Platform Notice: Data Center - This article applies to Atlassian products on the Data Center platform.

Note that this knowledge base article was created for the Data Center version of the product. Data Center knowledge base articles 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


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 Idle Bamboo agent reports that have been unused since a specific date for build plans and deployments from the database.

Building SQL statements for reporting purposes is not part of the Atlassian Support scope and this work is provided "as-is", on a best-effort basis. Queries may work better or worse than expected, your mileage may vary. It is up to each customer to analyze each query individually and understand if that is enough for their specific needs.

Environment

The SQL queries listed on this page have been tested on Bamboo 9.2.7 with Postgres DB but may also work with other versions of Bamboo.

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:

Idle Agent unused report for builds plans

To list out remote agents who have not built any plan jobs since a specific date(say, 2024-08-12 00:00:00) use the DB query below:

SELECT DISTINCT Q.TITLE
FROM queue q LEFT JOIN buildresultsummary bs ON q.queue_id=bs.build_agent_id
where q.agent_type = 'REMOTE' AND (enabled=true or enabled=false) and (last_stop_time is null) AND Q.TITLE not in 
(SELECT DISTINCT Q.TITLE
FROM queue q LEFT JOIN buildresultsummary bs ON q.queue_id=bs.build_agent_id
WHERE  bs.build_completed_date > '2024-08-12 00:00:00')

Idle Agent unused report for deployment projects

To list out remote agents who have not built any deployment jobs since a specific date(say, 2024-08-12 00:00:00) use the DB query below:

SELECT DISTINCT Q.TITLE 
FROM QUEUE Q LEFT JOIN DEPLOYMENT_RESULT DR ON Q.QUEUE_ID = DR.AGENT_ID 
where q.agent_type = 'REMOTE' AND (enabled=true or enabled=false) and (last_stop_time is null) AND Q.TITLE not in
(SELECT DISTINCT Q.TITLE 
FROM QUEUE Q LEFT JOIN DEPLOYMENT_RESULT DR ON Q.QUEUE_ID = DR.AGENT_ID 
WHERE DR.FINISHED_DATE > '2024-08-12 00:00:00')





Last modified on Nov 29, 2024

Was this helpful?

Yes
No
Provide feedback about this article
Powered by Confluence and Scroll Viewport.