Package Products :: Package ZenUtils :: Module ZenDeleteHistory :: Class ZenDeleteHistory |
[hide private]
[frames] | no frames]

# Class ZenDeleteHistory

source code

                 object --+
                          |
            CmdBase.CmdBase --+
                              |
    ZenScriptBase.ZenScriptBase --+
                                  |
                                 ZenDeleteHistory

Delete events and performance other maintenance tasks on the events database.

Instance Methods | [hide private]
buildOptions(self) basic options setup sub classes can add more options here | source code
run(self) | source code
executeStatements(self, statements) Executes a list of statements within a transaction. | source code
deleteHistory(self) Deletes events more than X days old where X is the number specified by the "numDays" command line argument. | source code
truncateHistory(self) Truncates the entire history table. | source code
cleanupTables(self) Cleans up the detail, log and alert_state accessory tables. | source code
optimizeTables(self) Manually optimizing tables after large amounts of rows have been deleted can improve their performance and reclaim unused space. | source code
analyzeTables(self) Manually analyzing tables is recommended after large deletions so that the optimizer can plan queries properly. | source code
Inherited from `ZenScriptBase.ZenScriptBase`: `__init__`, `closeAll`, `closedb`, `connect`, `findDevice`, `getConnection`, `getDataRoot`, `getDmdObj`, `login`, `logout`, `opendb`, `syncdb` Inherited from `CmdBase.CmdBase`: `buildParser`, `checkLogpath`, `generate_configs`, `generate_xml_configs`, `generate_xml_table`, `getConfigFileDefaults`, `parseOptions`, `pretty_print_config_comment`, `setupLogging`

Class Variables | [hide private]
Inherited from `CmdBase.CmdBase`: `doesLogging`

Method Details | [hide private]

### buildOptions(self) | source code
basic options setup sub classes can add more options here Overrides: CmdBase.CmdBase.buildOptions (inherited documentation)

### deleteHistory(self) | source code
Deletes events more than X days old where X is the number specified by the "numDays" command line argument. Optionally restricts the deletion to the device specified with the "device" command line argument.

### truncateHistory(self) | source code
Truncates the entire history table. This will also force a cleanup run to delete all orphaned rows in the accessory tables.

### cleanupTables(self) | source code
Cleans up the detail, log and alert_state accessory tables. If events are deleted from the history table without considering these tables, rows can be orphaned. This method cleans up these orphaned rows.

### optimizeTables(self) | source code
    Manually optimizing tables after large amounts of rows have been
    deleted can improve their performance and reclaim unused space.

    NOTE: Optimizing a table places a write-lock on it, and it can be a
          lengthy process.

### analyzeTables(self) | source code
    Manually analyzing tables is recommended after large deletions so that
    the optimizer can plan queries properly.

    NOTE: Analyzing an InnoBD tables places a write-lock on it. However,
          this is typically a quick process.