I have had a few requests for the script that we use here, including the
one below. I suppose that I should have included it for comparison to
begin with, but did not want to clutter the mail boxes....
Regards,
Scott
#!/apps/gnu/bin/perl
#
# Program Name: check_space_alarm.prl: or iteration thereof
#
# This program executes the CC program "space" on all public
# vobs. Output to ~smccadm/VOB_SPACE.LOG.
#
#############################################################
# Builds an associative array consisting of any public
# vob-storage-dir-pname
#############################################################
open(LSVOB,"/usr/atria/bin/cleartool lsvob|") || die "Can not open
process: $!";
while (<LSVOB>) {
next if ((index($_, " private")) >= $[);
$lastspace=0; $stlastspace=0;$firstslash=0; $nextspace=0; $length=0;
$lastspace=rindex($_, ' ');
$stlastspace=rindex($_, ' ', $lastspace-1);
$length=$lastspace-$stlastspace;
$vob_path=substr($_, $stlastspace, $length);
$firstslash=index($vob_path, '/',9);
$length=$firstslash-0;
$concat=substr($vob_path, 0, $length);
$firstslash=0; $nextspace=0; $length=0;
$firstslash=index($_, '/');
$nextspace=index($_, ' ', $firstslash);
$length=$nextspace-$firstslash;
$vob_tag=substr($_, $firstslash, $length);
$incl = $vob_tag;
$incls{$concat} .= $incl . ' ';
}
close(LSVOB);
#############################################################
# Uses associative array from previous block and records
# only the unique vob-storage-dir-pname (in VOB tag-name form)
# for cleartool space check (next block)
#############################################################
$i=0;
foreach $target (sort keys(%incls)) {
$temp= $incls{$target};
foreach $tempa (split(/ /, $temp)) {
#print "$target ::: $tempa\n";
$vobs_to_check[$i]=$tempa;
}
$i++;
}
#############################################################
# Using a VOB tag-name from previous block, checks unique
# vob-storage-dir-pname and mails USER if $maximum disk
# usage space is exceeded
#############################################################
$maximum=85;
$j=0;
foreach $vob_tag (@vobs_to_check) {
$j=0;
# print "HERE: $vob_tag\n";
open(VOBSPACE,"/usr/atria/bin/cleartool space $vob_tag|") || die "Can
not open process: $!";
while (<VOBSPACE>) {
$vobspace[$j++]=$_;
$total_line = $_ if ((index($_, "capacity")) >= $[) ;
}
$percent_sign=index($total_line, '%');
$percentage=substr($total_line, $percent_sign-2, 2);
@fs=split(/ +/, $total_line);
$file_sys=$fs[4];
if ($percentage > $maximum) {
open(MAIL,"|/bin/mailx -s \"ClearCase VOB free space alarm report
\($maximum\)\" smccadm ") || die "Can not open process: $!";
print MAIL " Use(Mb) %Use Directory\n";
print MAIL " ------- ---- ---------\n";
print MAIL "$total_line";
print MAIL "\n \n";
print MAIL "Usage is $percentage% ";
print MAIL "for these VOB(s):\n ";
foreach $target (sort keys(%incls)) {
$target_1=$target;
$target=substr($target,1);
if ($target eq $file_sys) {
$vob_list=$incls{$target_1};
@targs=split(/ /,$vob_list);
$l=@targs;
$elem=0;
while ($elem <= $l) {
print MAIL "$targs[$elem]\n";
$elem++;
}
}
}
print MAIL "on this filesystem: $file_sys\n";
close (MAIL);
}
@vob_space="";
}
close(VOBSPACE);
exit;
"Bartolone, Michel (MED)" wrote:
> If its not too big, why not just post it? I know I'd be interested in
> seeing yours (I'm looking at Bert Robbins
> script right now...)
>
> Mike
>
> -----Original Message-----
> From: Scott Mackillip [mailto:mmackill@aud.alcatel.com
> Sent: Tuesday, February 29, 2000 8:45 AM
> To: Juergen Amthauer
> Cc: cciug@Rational.Com
> Subject: Re: [cciug] ALERT script if HD is full on Solaris ?
>
> Juergen,
>
> We have a perl script here that does this, with a warning when the
> cleartool space command reveals that the disk is 85% full.
>
> If you would like, I could forward a copy of the script to you....all
> with no warranties, of course!
>
> Regards,
>
> Scott
>
> Juergen Amthauer wrote:
>
>
> Hi all
>
> Has anyone of you a script which signals via mail or so ... if the
> vobstorage area
> is near to 100 %
>
> ... or even better ... like in startrek
>
> green alert - all is good
> yellow alert - over 80 % disk filled
> red alert - over 90 %
>
> if one has a good idea how to check this automatically please reply,
> it's boring to do
> a df -k from time to time ...
>
>
>
> --
>
> best regards
>
> +------------------------------------------------------------------+
>
> Juergen Amthauer | mailto:Juergen.Amthauer@nbg6.siemens.de
> <mailto:Juergen.Amthauer@nbg6.siemens.de>
>
> Product Integration | mailto:juergen.pat@t-online.de
> <mailto:juergen.pat@t-online.de> (private)
>
> Siemens AG, EV NL D3 | WWW : http://www.nbg6.siemens.de/~amthauer
> <http://www.nbg6.siemens.de/~amthauer>
>
> Humboldtstrasse 59 | Voice :+49-911-433-8351
>
> D-90459 Nuremberg | Fax :+49-911-433-5494
>
> Germany |
>
> +------------------------------------------------------------------+
>
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
This archive was generated by hypermail 2b29 : Sun May 06 2001 - 00:23:31 EDT