Clearing out targets that haven't been used in a while

We have a octopus server that’s been in use for several years and has grown a bit larger than necessary. In part of the effort to clean it up and make it more manageable (and possibly get our licensing costs down) we’d like to get a list of “unused” targets. Is there a way in either the UI or via the api to get a list of the targets that haven’t been deployed to in the past year?

Hi Joshua,

Thanks for getting in touch! This is not a feature that we have built into Octopus, but should be possible via some API scripting.

The idea we had was to check the machines/tasks which will return all tasks executed on the target including the date the task was queued. If you check all machines for their most recent tasks, and if the task is older than say one year, then delete the machine.

As an example below, on my server, I call my machine by its Machines-ID. (if you leave the Spaces-ID blanks, it will do the default space)


In the returned json, there is a QueueTime parameter:

QueueTime: "2019-07-04T00:53:33.082+00:00",

This should all be available via the Octopus.Client, which would be our recommended option for scripting this via the API. We also have an open source repository with example API scripts which are great for getting started.

As a note, if you would like to see this kind of feature in Octopus, we have a UserVoice Suggestions page where we gauge community support for various features and ideas. If a suggestion gains enough support, we can look into its implementation into Octopus.

You are welcome to create your own suggestions, or vote and commend on existing suggestions.

Let me know how you go here. If you have any questions or run into any issues, please don’t hesitate to let me know.

Best regards,

This topic was automatically closed 30 days after the last reply. New replies are no longer allowed.