condor_usage scripts

Download
Last Updated: 2008-02-27
Author: Dan Bradley

This package contains two simple python scripts for use with Condor. One is condor_usage_daily. You run it periodically (e.g. daily) to save a snapshot of usage information on your condor pool(s). Then you can run it to generate reports of pool usage at various times in the past.

The script condor_usage_rrd may be run periodically to update an rrd database with condor usage information. It can also generate usage plots, such as this.

Both of these scripts take an optional module that maps users to groups for reporting purposes. An example map_glow_users.py is included.

Example Usage

Here is the cron entry that I use to generate daily usage reports for GLOW:

15 0 * * * /path/to/condor_usage_daily --update --state_dir=/home/cndracct/accounting.dan/data --pools=glow.cs.wisc.edu --group_mapper=map_glow_users --show_group_individuals=other --subject="Daily GLOW usage __date__" --footer='<BR>Usage history:<BR>http://www.hep.wisc.edu/cms/comp/glow_usage/' --recipients="glow-tech@cs.wisc.edu"

And here is the crontab entry I use to generate rrd plots:

5 * * * * /cms/cmsprod/bin/condor_usage_rrd_cron

Where condor_usage_rrd_cron is a script containing the following commands:

#!/bin/sh export PATH=/afs/hep.wisc.edu/cms/cmsprod/bin:/condor/bin:/usr/local/bin:$PATH rrd_dir=/scratch/cmsprod/condor_rrd groups='CMS|Atlas|LMCG|CS|MedPhysics|ChemE|IceCube' graph_dir=/afs/hep.wisc.edu/cms/www/comp/glow_usage group_mapper=map_glow_users condor_usage_rrd update --pool=glow.cs.wisc.edu --rrd_dir=$rrd_dir --group_mapper=$group_mapper condor_usage_rrd graph --days=365 --rrd_dir=$rrd_dir --groups=$groups --title="GLOW Condor Usage as of `date '+%Y-%m-%d'`" $graph_dir/glow_usage_1year.png > /dev/null condor_usage_rrd graph --plot_percentages --days=365 --rrd_dir=$rrd_dir --groups=$groups --title="GLOW Condor Usage as of `date '+%Y-%m-%d'`" $graph_dir/glow_usage_pct_1year.png > /dev/null condor_usage_rrd graph --days=60 --rrd_dir=$rrd_dir --groups=$groups --title="GLOW Condor Usage as of `date '+%Y-%m-%d'`" $graph_dir/glow_usage_2month.png > /dev/null condor_usage_rrd graph --plot_percentages --days=60 --rrd_dir=$rrd_dir --groups=$groups --title="GLOW Condor Usage as of `date '+%Y-%m-%d'`" $graph_dir/glow_usage_pct_2month.png > /dev/null condor_usage_rrd graph --days=2 --rrd_dir=$rrd_dir --groups=$groups --title="GLOW Condor Usage as of `date '+%Y-%m-%d %H:%M'`" $graph_dir/glow_usage_2day.png > /dev/null condor_usage_rrd graph --plot_percentages --days=2 --rrd_dir=$rrd_dir --groups=$groups --title="GLOW Condor Usage as of `date '+%Y-%m-%d %H:%M'`" $graph_dir/glow_usage_pct_2day.png > /dev/null for png in $graph_dir/*.png; do convert $png $graph_dir/`basename $png .png`.gif done