Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Pending Jobs Counter #2886

Open
martinorob opened this issue Oct 16, 2020 · 5 comments
Open

Pending Jobs Counter #2886

martinorob opened this issue Oct 16, 2020 · 5 comments

Comments

@martinorob
Copy link

Hi,
I'm having some trouble with pending jobs running on docker.
Is there any way to know using ps aux (for example) the number of pending jobs?

I nee to monitor this value..
I'm running
/snap/bin/docker exec CONTAINERID ps aux | grep foreman | wc -l
to retrieve the number of foreman process

I need some egual command to get the pending jobs..

May someone help me?
Thanks

@dsander
Copy link
Collaborator

dsander commented Dec 20, 2020

There is probably a way to trigger rails runner inside the docker container and run the command. I think it would be easier to login into Huginn using Huginn and grab the information that is already exposed via the API.

@martinorob
Copy link
Author

Api? Huginn expose api? Where i can find some docs?

thanks

@dsander
Copy link
Collaborator

dsander commented Dec 21, 2020

Well, I use the term API a bit loosely 😄 . We don't have anything officially documented, but every action that is done manually basically just makes HTTP to the Huginn server. The best option to see what does what is to treat Huginn the same as any other website you want to scrape/automate via Huginn. The amount of pending jobs can be retrieved via http://huginnurl/worker_status which returns something like this:

{
  pending: 0,
  awaiting_retry: 0,
  recent_failures: 5,
  event_count: 161504,
  max_id: 12344567,
  events_url: "/events?hl=1-12344567",
  compute_time: 0.165957941
}

@martinorob
Copy link
Author

martinorob commented Dec 22, 2020

Oh My god is what i was looking for! now i can reboot my docker only if pending is Greater of 100. thank you. Last question: any way to bypass auth page for the api curl request? Because i receive this message:

<html><body>You are being <a href="http://huginn.local:3000/users/sign_in">redirected</a>.</body></html>%

Using a browser, and after login, the api works successful! (but I need to authenticate trough curl for my checkhuginnpendins.sh script!)

@dsander
Copy link
Collaborator

dsander commented Feb 19, 2021

Sorry for the super late response, the "API" calls via curl have to be authenticated, when you have a cookie you can replicate a call like this with curl.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants