#!/usr/bin/perl # ---------------------------------------------------------------------- # File: eosreport # Author: Andreas-Joachim Peters - CERN # ---------------------------------------------------------------------- # ************************************************************************ # * EOS - the CERN Disk Storage System * # * Copyright (C) 2011 CERN/Switzerland * # * * # * This program is free software: you can redistribute it and/or modify * # * it under the terms of the GNU General Public License as published by * # * the Free Software Foundation, either version 3 of the License, or * # * (at your option) any later version. * # * * # * This program is distributed in the hope that it will be useful, * # * but WITHOUT ANY WARRANTY; without even the implied warranty of * # * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * # * GNU General Public License for more details. * # * * # * You should have received a copy of the GNU General Public License * # * along with this program. If not, see .* # ************************************************************************ my $year = $ARGV[0]; my $month = $ARGV[1]; my $day = $ARGV[2]; my $file = "/var/eos/report/$year/$month/$year$month$day.eosreport"; print "# Opening $file ..."; if (open IN ," $file") { while () { $_ =~ s/\&/\ /g; my @val = split (" ", $_); my $hash; foreach $kv (@val) { my ($key, $val) = split( "=",$kv); $hash->{$key} = $val; } my $time = ($hash->{cts}*1000) + $hash->{ctms} - ($hash->{ots}*1000) - $hash->{otms}; if ($time) { printf("%s uid=%s gid=%s r-bytes=%-10s\tr-rate=%03.02f\tr-size=%03.02f MB\tw-bytes=%-10s\tw-rate=%03.02f\tw-size=%03.02f MB path=%s\n", scalar localtime($hash->{ots}), $hash->{ruid}, $hash->{rgid}, $hash->{rb}, $hash->{rb} / $time /1000.0, $hash->{rb}/1000000.0, $hash->{wb}, $hash->{wb} / $time/1000.0, $hash->{wb}/1000000.0, $hash->{path}); } } } else { print "\n"; print "# Usage: eosreport \n"; }