Checking on the progress of a long running salt minion job?

1,046 views
Skip to first unread message

Justyn Shull

unread,
Jul 2, 2015, 6:07:10 PM7/2/15
to salt-...@googlegroups.com
Hello,

Is it possible to report some sort of status or progress for a long running minion job?   Basically I have a small API running on the salt-master server.    One of the functions of this api is to upload a python script to a salt-minion and then execute that script.   It does this by creating an async salt job, and periodically checking if it is finished yet.

The problem is that sometimes this script can take 30 minutes to an hour to complete, but we have no idea how far along it is without logging directly into the minion to check.    We do periodically print out the status of the script to a log file on the minion.   Once the script finishes, salt will return the results we expect so we at least know it's finished.

Does anyone have an idea on how to report some sort of progress while the script is running?    I'd even be happy with salt returning the stdout of the script every time it checks for a result, but I don't think that is possible at the moment.

My current idea is to just use cmd.run 'tail -n 5 /root/scriptlog.log' and returning that to our web UI that triggers everything, but it seems like there should be an easier way to do it.

Thanks,

viq

unread,
Jul 3, 2015, 3:09:37 AM7/3/15
to salt-...@googlegroups.com

You could have the script fire events on the event bus and look for those, maybe using salt-eventsd to help with that.

--
You received this message because you are subscribed to the Google Groups "Salt-users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to salt-users+...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Colton Myers

unread,
Jul 14, 2015, 6:42:29 PM7/14/15
to salt-...@googlegroups.com
Yep, I would recommend using the event bus. You can fire events using `salt-call event.send`. Then on the master side you can monitor for those events using `salt-run state.event tagmatch=<glob pattern for tag>`. Then it will show all events that match the glob pattern in their tag, so you can monitor for the specific events your long job is generating, and see where in the process it is.

Hope that helps!

--
Colton Myers
Platform Engineer, SaltStack
@basepi on Twitter/Github/IRC
Reply all
Reply to author
Forward
0 new messages