Expand my Community achievements bar.

Don’t miss the AEM Skill Exchange in SF on Nov 14—hear from industry leaders, learn best practices, and enhance your AEM strategy with practical tips.
SOLVED

Need curl command to display queued agents using linux script from AEM

Avatar

Level 2

I need curl command to display list of queued agents in AEM author and publisher using Linux scripting. If someone have idea please share.

 

Thank you.

1 Accepted Solution

Avatar

Correct answer by
Community Advisor

To clarify, you cannot achieve this with a single request. Instead, you need to follow a series of steps. As I mentioned in my previous answer, first, you should query all the available agents. Then, use the dynamically retrieved agents to gather their details. With that information, you can refine and produce whatever output or formatted response you need. You’ll need to incorporate these steps into a Bash script and use curl as necessary to implement your desired outcome.

 

I hope this helps!



Esteban Bustamante

View solution in original post

8 Replies

Avatar

Community Advisor
 

Hi,

 

Could you elaborate on what you are trying to achieve? Are you looking to see which agents are full or empty? Is this specifically related to replication agents?

One way to accomplish this is to build your own service (servlet) that returns the information you need in the desired format, which you can then invoke from your Linux script. In the servlet, you have access to the Agent Interface, allowing you to check aspects like the queue: Agent Interface Documentation. Depending on your requirements, you can also use other OOTB Java APIs to build your service.

 

Servlet reference:

https://medium.com/@toimrank/aem-sling-servlet-ca9e5926a384 

https://www.youtube.com/watch?v=ZAlR0nPdpSI&ab_channel=AEMGEEKS

 

Hope this helps



Esteban Bustamante

Avatar

Level 2

Thank for the response.

 

But i have the requirement to display the queued or blocked agents names and count using Linux scripting for the AEM author and publisher. So I am expecting curl command to get all blocked agents list from server.

 

And i need to know we can archive or not for this in Linux scripting.

Avatar

Community Advisor

Yes, you can use the following URLs to achieve what you need:

 

  1. These will give you the list of agents: http://aemHost:port/etc/replication/agents.author.2.json and http://aemHost:port/etc/replication/agents.publish.2.json. These endpoints will provide all the agents, and from here, you will need to filter out which ones are "enabled."

  2. You can build new requests based on the results from step 1, following this format: http://aemHost:port/etc/replication/agentLocation/nameOfTheAgent/jcr:content.queue.json?agent=nameOf..., where agentLocation is either agents.author or agents.publish, and nameOfTheAgent is the name of the agent.

    For example: http://aemHost:port/etc/replication/agents.author/publish/jcr:content.queue.json?agent=publish.

  3. Based on the above request, you can count and check the status of the agents to see if they are blocked or queued.

Hope this helps

 

 

 

 



Esteban Bustamante

Avatar

Level 2

Hi EstebanBustamante,

 

I reviewed above comments and i am able to check the status using below command for single agent.

http://aemHost:port/etc/replication/agents.author/publish/jcr:content.queue.json?agent=publish

But my expectation is to check dynamic for all the queued agents list 

present under publisher location(/etc/replication/agents.publish).

 

Note: I have large no.of agents under publisher.

Avatar

Correct answer by
Community Advisor

To clarify, you cannot achieve this with a single request. Instead, you need to follow a series of steps. As I mentioned in my previous answer, first, you should query all the available agents. Then, use the dynamically retrieved agents to gather their details. With that information, you can refine and produce whatever output or formatted response you need. You’ll need to incorporate these steps into a Bash script and use curl as necessary to implement your desired outcome.

 

I hope this helps!



Esteban Bustamante

Avatar

Level 2

Hi Narendiran,

Thanks for your response.

Yes. i have already viewed the article and mentioned only shingle agent status check.

But my expectation is to check dynamic for all the queued agents list 

present under publisher location(/etc/replication/agents.publish).