ADSM-L

A query and some code...

2003-06-26 14:40:27
Subject: A query and some code...
From: asr AT UFL DOT EDU
To: ADSM-L AT VM.MARIST DOT EDU
Date: Thu, 26 Jun 2003 14:40:03 -0400
I'm trying to collect data on what "average" utilization rates are on tape
devices.  I'm attempting to support or erode the case "We need more" :)

One thing that would be an interesting number (I decided) was the percent
utilization of tape mount points.  So I whipped out my PERL, and...

Submitted for your approval (and hopefully execution!) please find enclosed
"mountpct", a script that takes the output of a 'q actlog', and makes a rough
calculation of the tape mount time available and used.

I start counting with the first recorded mount, and stop at the last recorded
unmount.

Anyone who's willing, please consider running this against a sizable chunk of
"q actlog" with tab formatting.  I collect the actlogs every day and ferret
them away, so I've got gobs of them, but you can do something like


dsmadmc -id=[something]  \
        -password=[something]  \
        -tab  \
        "q actlog begint=00:00 begind=-14 days" \
        | ./mountpct


here's mine...  (I'm only retaining 10 days at the moment)

DRIVE_A: 12351.100 minutes.
DRIVE_B: 11503.333 minutes.
DRIVE_C: 11421.667 minutes.
DRIVE_D: 11531.550 minutes.
 Earliest mount occurred : Mon Jun 16  9:00:12 EDT 2003
 Last unmount occurred : Thu Jun 26 14:19:48 EDT 2003
 Actlog covers 14719.600 minutes.
 With 4 devices, 58878.4 device-minutes available.
 of which 46807.65 used. (79.499 %)




- Allen S. Rout






#!/usr/local/bin/perl -- -*-Perl-*-

use Time::ParseDate;
use Time::CTime;

my $verbose = 1;
my $spans = {};
my $working = {};
my $firstmount  = 6000000000;
my $lastunmount = 0;

while (<>)
  {
#    print;
    next unless /ANR8468I|ANR8337I/;

    my @f = split(/\s+/);
    my $t = parsedate("$f[0] $f[1]");
    my $to = ctime($t);

    if ($f[2] eq "ANR8337I")
      {# Mount req.
        $drive = $f[9];
        if ($working->{$drive})
          { warn "dual mount recorded?\n"; }
        else
          {
            $working->{$drive} = $t;
            $firstmount = $t if ( $t < $firstmount ) ;
          }
      }
    elsif ( $f[2] eq "ANR8468I")
      {# Dismount
        $drive = $f[9];
        if ($working->{$drive})
          {
            my $begin = $working->{$drive};
            my $end = $t;
            $lastunmount = $t if ($t > $lastunmount);
            my $run = $end - $begin;
            $spans->{$drive} = 0 unless defined ($spans->{$drive});
            $spans->{$drive} += $run;
            delete $working->{$drive}
          }
        else
          { warn "dual (or initial) dismount recorded?\n";  }

      }
    else
      {
        #Huh?
        die "How'd we get here?\n";
      }
  };


my $count = 0;
my $tmin = 0;

foreach $s ( sort keys %$spans )
  {
    $count++;
    my $c = $spans->{$s};
    my $min = sprintf("%.3f",$c / 60);

    $tmin += $min;
    print "$s: $min minutes.\n";

  }

print " Earliest mount occurred : ",ctime($firstmount);
print " Last unmount occurred : ",ctime($lastunmount);

my $range;

$range = $lastunmount - $firstmount;
$range /= 60;
$range = sprintf("%.3f",$range);

my $pct;

$pct = sprintf("%.3f",$tmin/($range * $count) * 100);


print " Actlog covers $range minutes.\n";
print " With $count devices, ",$range * $count," device-minutes available.\n";
print " of which $tmin used. ($pct %)\n";


sub pm
  {
    my $n = shift;
  }

<Prev in Thread] Current Thread [Next in Thread>