Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.
Comment: Clarify three levels of Purging Policy

Table of Contents

Introduction

Versions 2.2 (and newer) of opConfig provide more detailed collection and display of operational status, and now also let you control whether and when old data should be expired. This document describes how to configure these features.

...

  • the number of revisions to keep, controlled by the property  keep_last,
  • and the maximum age of a revision, controlled by the property purge_older_than.

To explicitely explicitly disable keep_last or purge_older_than simply set the value to 0.

...

Protected revisions are not considered or counted and left untouched. The age of a revision is based on its "last updated" timestamp.

When a revision is removed, it also remove the associated job, if no other revision are linked to that job, since opConfig 3.5.1.

Inheritance, Setting up defaults

There are three levels of purging policy:

  1. Global
  2. Command Set
  3. Command

Global

You can set a global default purging policy in conf/opCommon.nmis:

Code Block
'opconfig' => {
 ...
 'opconfig_purging_keep_last' => 100,        # keep 100 most recent revisions
 'opconfig_purging_purge_older_than' => 31536000, # purge revsrevisions older than 1 year
 'opconfig_purging_autoprotect_first_revision' => 'true', # protect the first revision by default

Command Set

You can extend or overrule that default for a whole command set, in in conf/command_sets.d/{vendor-name}.nmis:

Code Block
'IOS_HOURLY' => {                  # command set name
  ...
  'purging_policy' => {
    'keep_last' => 1000,
    'purge_older_than' => 2592000, # 30 days
    'autoprotect_first_revision' => 'true', 
  },    

This example overrules all the global defaults for all commands in the IOS_HOURLY set, with a shorter retaining period (but a higher number of minimum entries). 

Command

Finally, you can also set a purging policy for a single command in a command set only, again overriding any of the command set or the global defaults. Here is such an example, again configured in in conf/command_sets.d/{vendor-name}.nmis:

Code Block
'TS_LINUX_PROCESSES' => {         # command set name
  ...
  'commands' => [
    {
      'multipage' => 'true',
      'privileged' => 'true',
      'command' => 'ps -ef',      # command
	  'keep_last' => 0,
	  'purge_older_than' => 86400, 
      'tags' => [ 'troubleshooting', 'operatingsystem' ],
    },
  ],
},

This example makes sure that for the command "ps -ef" in the TS_LINUX_PROCESSES command set, only the last day's revisions are kept, regardless of any global defaults policy or policy for the TS_LINUX_PROCESSES set. Note that keep_last needs to be disabled explicitely explicitly here, or the defaults for this setting would be inherited.

...

This cron entry would run a daily purge at 03:40.

Jobs

The jobs are purged every time a revision is purged, if there are no other active revisions linked to the job. This was modified since version 3.5.1.

But there is another cli tool, to remove jobs with no revisions associated. This jobs are purged based on the configuration option: 

opconfig_queue_expire_after_seconds

Set to 8 days by default => 86400 * 8. The purging operation is not automatic and needs to be triggered with opconfig-cli.pl, ideally from a cron job:

Code Block
# /etc/cron.d/opconfig for example
40 3 * * *     root /usr/local/omk/bin/opconfig-cli-pl act=purge_queue