Andrew DeFaria <Andrew@ClearSCM.com>
Mon Oct 25 11:10:47 PDT 2008
Modifed 2011/01/14 16:50:54
This script serves 4 distinct functions. One function is to find old views and report them to their owners via email so that view cleanup can be done. Another function just does a quick report stdout. Yet another function is to present the list of views in a web page. Finally there is a function (generate) which generates a cache file containing information about views. This function is designed to be run by a scheduler such as cron. Note that the web page function relies on and uses this cache file too.
Most Clearcase administrators wrestle with trying to keep the number of views under control. Users often create views but seldom think to remove them. Views grow old and forgotten.
Many approaches have been taken, usally emailing the users telling them to clean up their views. This script, viewager.cgi, attempts to encapsulate the task of gathering information about old views, informing users of which of their views are old and presenting reports in the form of a web page showing all views including old ones.
USAGE Email, Report and Generate modes
Usage viewager.cgi: [-u|sage] [-region <region>] [-e|mail] [-a|gethreshold <n>] [-n|brThreshold <n>] [-ac|tion <act>] [-s|ort <field>] [-v|erbose] [-d|ebug] Where: -u|sage: Displays usage -region <region>: Region to use when looking for views (Default for generate action: all) -e|mail: Send email to owners of old views -ag|eThreshold: Number of days before a view is considered old (Default: 180) -n|brThreshold <n>: Number of views to report. Can be used for say a "top 10" old views. Useful with -action report (Default: Report all views) -ac|tion <act> Valid actions include 'generate' or 'report'. Generate mode merely regenerates the cache file. Report produces a quick report to stdout. -s|ort <field>: Where <field> is one of <tag|ownerName|type|age> -ve|rbose: Be verbose -d|ebug: Output debug messages
USAGE Web Page mode
Parameters for the web page mode are provided by the CPAN module CGI and are normally passed in as part of the URL. These parameters are specified as name/value pairs:
sortby=<tag|ownerName|type|age> Note: age will sort in a reverse numerical fashion user=<username> <username> can be a partial name (e.g. 'defaria')
This script seek to handle the general issue of handling old views. In generate mode this script goes through all views collecting data about all of the views and creates a cache file. The reason for this is that this process is length (At one client's site with ~2500 views takes about 1 hour). As such you'd probably want to schedule the running of this for once a day.
Once the cache file is created other modes will read that file and report on it. In report mode you can report to stdout. For example, the following will give you a quick "top 10" oldest views:
$ viewager.cgi -action report -n 10