How do I delete RTM historical data of jobs in specific time intervals?

In some special cases you may need to delete the RTM historical data for jobs in a specific time segment. This cannot be performed using the RTM console.

About this task

Delete the historical data of jobs in specific time intervals by using the following steps:

Procedure

  1. For jobs in a "running" state but are actually not running:
    mysql -u root cacti -e "delete from grid_jobs where start_time>=timestamp 
    {begin_datetime} and start_time<timestamp> {end_datetime};"

    To keep data for jobs in 'USUSP', 'SSUSP', 'ZOMBI', and 'UNKWN' states, append the condition "stat='RUNNING'":

    mysql -u root cacti -e "delete from grid_jobs where start_time>=timestamp 
    {begin_datetime} and start_time
    mysql -u root cacti -e "delete from grid_jobs where start_time>=timestamp 
    {begin_datetime} and start_time
  2. For jobs in a "finished" state:
    mysql -u root cacti -e "delete from grid_jobs_finished where start_time>=timestamp 
    {begin_datetime} and start_time<timestmp {end_datetime}>
    Alternatively, replace the table grid_jobs_finished with grid_jobs_finished_<newname> according to the actual table name on the site.