Using APIs how can we clear out the completed actions in the Satellite scheduler ?

Solution Verified - Updated -

Environment

  • Red Hat Network Satellite Server 5.5

Issue

  • archiving completed action through the web ui of satellite raises an error 500
  • archiving completed action through the web ui of satellite takes too long and causes apache sessions to expire
  • On Satellite there are 10000+ completed actions in the scheduler. If you click on that view and try to delete/archive them satellite hangs, requiring restart. How can we clean those actions ?
  • How to archive or delete 10000+ actions ?

Resolution

As of satellite 5.5 the following api function has been implemented to archive elements :

schedule.archiveActions

here is an exemple, archiving all actions :

#!/usr/bin/python
import xmlrpclib
client = xmlrpclib.Server('http://satellite.example.com/rpc/api',verbose=0)
key = client.auth.login('satadmin','satadminpassword')

#archive all Failed Actions
failed_list = client.schedule.listFailedActions(key)
action_ids=[]
for action in failed_list:
    action_ids.append(action['id'])

archive_result=client.schedule.archiveActions(key,action_ids)

#archive all Completed Actions
completed_list = client.schedule.listCompletedActions(key)
action_ids=[]
for action in completed_list:
    action_ids.append(action['id'])

archive_result=client.schedule.archiveActions(key,action_ids)

#delete all Archived Actions
archived_list = client.schedule.listArchivedActions(key)
action_ids=[]
for action in archived_list:
    action_ids.append(action['id'])

del_result=client.schedule.deleteActions(key,action_ids)
client.auth.logout(key)

This would work for satellite satellite.example.com using the user satadmin and the password satadminpassword.

Note : if the list of actions is too large to be processed even by the api, then you can try to use the list of actions for each systems using system.listSystemEvents

Root Cause

It's pretty common for people to have a lot of completed items like 'Show differences between profiled config files and deployed config files', which are automatically scheduled every night by Taskomatic for systems subscribed to configuration channels. You can cut down on the frequency if you don't need need it nightly (or at all) by modifying the Taskomatic schedule from the web UI:

Admin > Task Schedules > compare-configs-default > (modify or delete the schedule) > Edit Schedule

Attachments

This solution is part of Red Hat’s fast-track publication program, providing a huge library of solutions that Red Hat engineers have created while supporting our customers. To give you the knowledge you need the instant it becomes available, these articles may be presented in a raw and unedited form.

Comments