Example cleanup plan for large operational environments
This topic walks you through an example end-to-end process of setting up a comprehensive plan for cleaning up your TrueSight Server Automation (BSA) database in a large operational environment, where the database fills up quickly, and the standard weekly cleanup plan (described in Example-weekly-database-cleanup-plan) is not sufficient. This cleanup plan can also be used in situations where you have accumulated large amounts of BladeLogic data in the database due to failures in the basic weekly cleanups, and you need to temporarily apply a more forceful cleanup plan to catch up on database maintenance.
The cleanup plan described here involves a combination of cleanup jobs organized within Batch Jobs and scheduled to run on a frequent basis (mostly daily, some weekly). Setting up the cleanup plan involves the following tasks:
- Define retention periods.
- Create multiple cleanup jobs based on the default cleanup job that is provided out-of-the-box. Each of these jobs is designed to perform an individual cleanup function.
- Organize the various cleanup jobs that you created (in the previous task) as the building blocks in more complex Batch Jobs — one for the daily cleanup of historical data, and the other for weekly hard deletion of additional data that is not fully deleted by the daily job.
This topic includes the following sections:
How to set and enable retention times
Before running Database Cleanup Jobs, you must set retention periods for two types of BSA data. You must also enable a retention policy, so that data that is older than the defined retention periods is marked for deletion. For more information about tasks related to retention periods and the retention policy, see Marking-data-for-deletion.
Step | Example screen | |
---|---|---|
1 | Set a retention period for job run data and job results through the Property Dictionary. In this example we define a retention period of 30 days (the length of time recommended by BMC) for all jobs of all types.
| |
2 | We will be using the TrueSight Server Automation Application Server console (the blasadmin utility) to set a retention period for auto-generated objects and to enable the retention policy. To start the Application Server Administration console, perform the following step:
For alternative methods, see Starting-the-Application-Server-Administration-console. | |
3 | Auto-generated objects typically include BLpackages involved in compliance remediation or patch remediation, as well as Deploy Jobs and Batch Jobs from these remediation processes. To specify a retention period for auto-generated objects, enter the following command: | |
4 | To enable the retention policy. Enter the following command:set Cleanup EnableRetentionPolicy true | |
5 | For your changes to take effect, restart the Application Server. Perform the following steps:
For alternative methods, see Restarting Application Servers. |
How to create jobs for individual cleanup functions
For greater control over the various cleanup functions, we will create multiple copies of an out-of-the-box NSH Script Job named BSA Recommended Database Cleanup Job, and customize each new job to perform an individual cleanup function (that is, to execute an individual delete command). In each of these new jobs, we will customize the job parameters, which are inherited from the BSA Recommended Database Cleanup Script. All these jobs will serve as the building blocks in the next task, when we organize the individual cleanup jobs in Batch Jobs. (For more about the out-of-the-box script and job, see Performing online database cleanup.)
Step | Example screen | |||||||||
---|---|---|---|---|---|---|---|---|---|---|
1 | To create your first copy of the default cleanup job, perform the following steps:
| |||||||||
2 | To open the new job, right-click Copy of BSA Recommended Database Cleanup Job, and select Open. | |||||||||
3 | In the content editor on the right, on the General tab, change the name of this new job to Cleanup AuditTrail, and the description to Cleanup of the Audit Trail. Then click Save | |||||||||
4 | To customize job parameters, click the Parameters tab, and then make the following changes to parameter settings:
For more information about the script parameters, see Script parameters. | |||||||||
5 | Save the job again to apply all changes. | |||||||||
6 | Repeat steps 1 to 5 for another 12 cleanup functions. The following table lists all 13 cleanup jobs that you need to create, and includes the name for each job (to rename in step 3) and the parameter settings that you need to adjust (in step 4). You need to create Cleanup Retention job only once. Tip: To speed up the process of creating these jobs, choose a source job (in step 1) with parameter settings that are similar to those of the target job. For example, to create the Cleanup JobRunEvent job, copy the Cleanup AuditTrail job and adjust just the job name and description and the ObjectType parameter. You can also paste multiple copies of the same source job. |
Job names and parameters to adjust in the cleanup jobs for individual cleanup functions
Job name | Execution | Object | Retention | Other |
---|---|---|---|---|
Cleanup AuditTrail | HISTORY_ORDR | AuditTrail | 30 | Set to ignore: MaxDuration Do not change: ContinueOnError |
Cleanup JobRunEvent | HISTORY_ORDR | JobRunEvent | ||
Cleanup JobSchedule | HISTORY_ORDR | JobSchedule | ||
Cleanup SharedData | HISTORY_ORDR | SharedData | ||
Cleanup AuditResult | HISTORY_ORDR | AuditResult | set to ignore | Set to ignore: MaxDuration Do not change: ContinueOnError |
Cleanup ComplianceResult | HISTORY_ORDR | ComplianceResult | ||
Cleanup Deploy | HISTORY_ORDR | Deploy | ||
Cleanup PatchResult | HISTORY_ORDR | PatchResult | ||
Cleanup SnapshotResult | HISTORY_ORDR | SnapshotResult | ||
Cleanup OldVersionComponent (Available in 8.9.02 and later versions) | HISTORY_ORDR | OldVersionComponent | ||
Cleanup OldVersionJob (Available in 8.9.02 and later versions) | HISTORY_ORDR | OldVersionJob | ||
Cleanup AppServerCaches | CLEAN_ALL_AS | set to ignore | 30 | Set to ignore: MaxDuration Do not change: ContinueOnError |
Cleanup Database | CLEAN_DB | set to ignore | set to ignore | Set to ignore: MaxDuration Do not change: ContinueOnError |
Cleanup Shared Objects | CLEAN_SHARED_OBJECTS | |||
Cleanup FileServer | CLEAN_FS | |||
Cleanup Retention | RETENTION | |||
Cleanup ListBLValue | HISTORY_ORDR | ListBLValue | Set to ignore | Set to ignore |
How to organize the individual cleanup jobs into Batch Jobs for a comprehensive cleanup plan
We will now organize the various cleanup jobs that we prepared into two Batch Jobs — one for the daily cleanup of historical data, and the other for weekly hard deletion of additional data that does not get deleted by the daily job. The daily cleanup job is a relatively complex Batch Job, with another two Batch Jobs nested within it (one within the other). The hierarchical organization of cleanup jobs within these Batch Jobs is as follows:
- Daily cleanup of historical data:
Batch Job named Daily Cleanup. This job contains the following jobs, set to run sequentially:- Cleanup Retention
Batch Job named Cleanup Historical, with the following jobs set to run in parallel:
- Cleanup JobRunEvent
- Cleanup AuditTrail
- Cleanup JobSchedule
- Cleanup SnapshotResult (If you are using TrueSight Server Automation 8.9.03.001 and later, you cannot run this job in parallel.)
However, you cannot execute two or more Cleanup Historical batch jobs in parallel
- Batch Job named Cleanup Results, with the following cleanups set to run sequentially:
- Cleanup AuditResult
- Cleanup ComplianceResult
- Cleanup PatchResult
- Cleanup Deploy
- Cleanup SharedData
- Cleanup SnapshotResult (This is applicable for TrueSight Server Automation 8.9.03.001 and later.)
- Cleanup ListBLValue
- Cleanup OldVersionComponent
- Cleanup OldVersionJob
- Cleanup AppServerCaches
- Weekly hard delete cleanup:
Batch Job named Weekly Cleanup. This job contains the following jobs, set to run sequentially:- Cleanup Retention
- Cleanup Database
- Cleanup Shared Objects
- Cleanup FileServer
The following instructions guide you through the creation of these Batch Jobs. For the daily cleanup job, we will start with the creation of the most nested, lowest-level Batch Job, and work our way upward and outward until we have created the final daily Batch Job.
Step | Example screen | |
---|---|---|
1 | To create the most nested Batch Job, which groups together the cleanup of job results, perform the following steps:
| |
2 | To create the next Batch Job, which groups together the cleanup of historical data, perform the following steps:
| |
3 | To create the final Batch Job for daily cleanup of historical data, perform the following steps:
| |
4 | To create the weekly Batch Job for hard deletion of other types of data, perform the following steps:
|
Where to go from here
If you set up this cleanup plan as a temporary means for catching up on the deletion of old data that accumulated in your database, you can follow the current plan for several weeks and then revert back to the basic plan described in Example-weekly-database-cleanup-plan.
For more complicated situations, where you have accumulated large amounts of BladeLogic data in the database, you might need to plan a period of downtime for your TrueSight Server Automation Application Server so that you can perform a one-time offline database cleanup, a more forceful cleanup mechanism.
In addition to the jobs described here, schedule a monthly cleanup of the agents and repeater server. Create cleanup jobs set to individual modes CLEAN_AGENT and CLEAN_REPEATER, and optionally include the two jobs within a batch job. For best results, keep these cleanup jobs separate from database cleanup (for example, do not include database cleanup in the same batch job).