Monitoring jobs via API

572 views
Skip to first unread message

Dhanasekaran Anbalagan

unread,
Oct 26, 2016, 3:51:59 AM10/26/16
to rundeck...@googlegroups.com
Hi Guys,

I like to know, How can I monitor jobs via api. In our case we are running more then 400 jobs per day, I like to know what are job failed and killed jobs list.

Please guide me.

Kind regards,
Dhanasekaran.
 
Did I learn something today? If not, I wasted it.

Alex Honor

unread,
Oct 26, 2016, 10:53:45 AM10/26/16
to rundeck...@googlegroups.com
Hi,

It can list executions per job status. The recentFilter and olderFilter can limit to a time frame. You might also look at the new CLI tool which you can use to query executions.


Eg, list all executions in the last month:

rd executions query -p anvils --recent 1m

--
You received this message because you are subscribed to the Google Groups "rundeck-discuss" group.
To unsubscribe from this group and stop receiving emails from it, send an email to rundeck-discuss+unsubscribe@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/rundeck-discuss/CAJzooYezda_YHggf%2BRjxt%3D-EHPYuHXEzZ2Bk3Q-Dokn1M86dhQ%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.



--

Alex Honor

[SimplifyOps, Inc | a...@simplifyops.com ]

Be sure to comment and vote on Rundeck Feature Development!

Dhanasekaran Anbalagan

unread,
Oct 26, 2016, 2:27:07 PM10/26/16
to rundeck...@googlegroups.com
Hi Alex,

Many thanks for helping me.

Have used https://github.com/marklap/rundeckrun python api. I can queary directly to rundeck.

from pprint import pprint
from rundeck.api import RundeckApiTolerant
import xmltodict

rd = RundeckApiTolerant(server='172.16.60.21', api_token='JJ4vqSbFA9iFZ3d2UTTuwv9hnxK5FK1N')
execution = rd.history(project='Dhana', recentFilter='1d', max='10', statFilter='fail')

## vaild statFilter =  succeed / fail / cancel

rd_history_dump = xmltodict.parse(execution.body)

for jobs in rd_history_dump['result']['events']['event']:
    print jobs['title'], jobs['status'], jobs['execution']['@id']


Kind regards,
Dhanasekaran.


Did I learn something today? If not, I wasted it.

Reply all
Reply to author
Forward
0 new messages