/[cricket]/parse_omni.pl
This is repository of my old source code which isn't updated any more. Go to git.rot13.org for current projects!
ViewVC logotype

Contents of /parse_omni.pl

Parent Directory Parent Directory | Revision Log Revision Log


Revision 1.1 - (show annotations)
Mon Sep 9 18:36:29 2002 UTC (21 years, 7 months ago) by dpavlin
Branch: MAIN
File MIME type: text/plain
added module for HP OmniBack

1 #!/usr/bin/perl -w
2 #
3 # cricket module which parses output from HP OmniBack omnistat command
4 # line utility (you need to have User Interface installed on machine
5 # on which you plan to run omni_parse.pl) and draws nice graphs about
6 # concurrent jobs (can be used to plan licenses)
7 #
8 # Dobrica Pavlinusic <dpavlin@rot13.org>
9 # http://www.rot13.org/~dpavlin/sysadm.html
10 #
11 # Usage:
12 #
13 # parse_omni.pl [/path/to/omnistat]
14 #
15 # Warning: I am not sure that I can catch all types which are known to
16 # omnistat. So far, I check and report following ones:
17 #
18 # Aborted
19 # Completed
20 # Completed/Errors
21 # Completed/Failures
22 # Failed
23 # In Progress
24 #
25 # All other (if there are any) will be reported as other (I really need to
26 # re-read OmniBack documentation!)
27
28 use strict;
29
30 my $omnistat= shift @ARGV || "/usr/omni/bin/omnistat";
31
32 my @stat = (
33 'In Progress',
34 'Aborted',
35 'Completed',
36 'Completed/Errors',
37 'Completed/Failures',
38 'Failed',
39 );
40
41 my %backup;
42 my %restore;
43
44 open(O,"$omnistat |") || die "can't start $omnistat !";
45 while(<O>) {
46 chomp;
47 my @arr = split(/ +/,$_,4);
48 next if ($#arr != 3);
49
50 if ($arr[1] =~ m/Backup/i) {
51 $backup{$arr[2]}++;
52 } elsif ($arr[1] =~ m/Restore/i) {
53 $restore{$arr[2]}++;
54 } elsif ($arr[1] !~ m/Type/) {
55 # don't report this on header!
56 print STDERR "unknown type: $arr[1]";
57 }
58 }
59 close(O);
60
61 # dump backup data
62
63 foreach (@stat) {
64 if (defined $backup{$_}) {
65 print $backup{$_},"\n";
66 delete $backup{$_};
67 } else {
68 print "0\n";
69 }
70 }
71 my $other;
72 foreach (keys %backup) {
73 $other += $backup{$_};
74 }
75 print $other || "0\n";
76
77 # dump restore data
78
79 foreach (@stat) {
80 if (defined $restore{$_}) {
81 print $restore{$_},"\n";
82 delete $restore{$_};
83 } else {
84 print "0\n";
85 }
86 }
87 undef $other;
88 foreach (keys %restore) {
89 $other += $restore{$_};
90 }
91 print $other || "0\n";
92

  ViewVC Help
Powered by ViewVC 1.1.26