Changed cvs_man.php -> scm_man.php.
[clearscm.git] / clearadm / index.cgi
1 #!/usr/bin/perl
2
3 =pod
4
5 =head1 NAME $RCSfile: index.cgi,v $
6
7 Clearadm: Portal to your Clearcase Infrastructure
8
9 =head1 VERSION
10
11 =over
12
13 =item Author
14
15 Andrew DeFaria <Andrew@ClearSCM.com>
16
17 =item Revision
18
19 $Revision: 1.22 $
20
21 =item Created:
22
23 Mon Oct 25 11:10:47 PDT 2008
24
25 =item Modified:
26
27 $Date: 2011/02/14 14:50:48 $
28
29 =back
30
31 =head1 DESCRIPTION
32
33 Clearadm is a web based portal into your Clearcase infrastucture. It seeks to
34 provide your CM staff with an easy to use, yet informative interface to locate,
35 report on and monitor various aspects of the Clearcase infrastructure.
36
37 =cut
38
39 use strict;
40 use warnings;
41
42 use FindBin;
43 use Getopt::Long;
44
45 use CGI qw (:standard *table start_Tr end_Tr);
46 use CGI::Carp 'fatalsToBrowser';
47
48 use lib "$FindBin::Bin/lib", "$FindBin::Bin/../lib";
49
50 use ClearadmWeb;
51 use Clearadm;
52 #use Clearcase;
53 #use Clearcase::Views;
54 use Display;
55 use Utils;
56
57 my $clearadm = Clearadm->new;
58
59 # Main
60 GetOptions (
61   'usage'        => sub { Usage },
62   'verbose'      => sub { set_verbose },
63   'debug'        => sub { set_debug },
64 ) or Usage "Invalid parameter";
65
66 # Announce ourselves
67 verbose "$ClearadmWeb::APPNAME V$ClearadmWeb::VERSION";
68
69 heading;
70
71 display p '&nbsp;';
72 display p <<"END";
73 Clearadm is a web based portal into your infrastructure. It seeks to provide
74 your system administrative staff with an easy to use, yet informative interface
75 to locate, report on and monitor various aspects of your infrastructure. 
76 END
77   display p <<"END";
78 Additionally, Clearacdm is aware of Clearcase servers as well as Clearcase
79 objects such as views, vobs, etc. When systems are added to Clearadm that house
80 or server Clearcase objects, additional information is collected about those
81 objects.
82 END
83
84 display h1 {class => 'center'}, 'Systems Snapshot';
85
86 display start_table {cellspacing => 1};
87
88 my $i = 0;
89 my $perRow = 5;
90
91 display start_Tr;
92
93 my @systems = $clearadm->FindSystem;
94
95 $perRow = @systems if @systems < $perRow;
96
97 foreach (@systems) {
98   my %system = %{$_};
99   
100   if ($i++ % $perRow == 0) {
101     display end_Tr;
102     display start_Tr; 
103   } # if
104
105   my %load = $clearadm->GetLatestLoadavg ($system{name});
106
107   my $data;
108   
109   $data = '<strike>'
110     if $system{active} eq 'false';
111     
112   $data .= a {
113     href => "systemdetails.cgi?system=$system{name}"
114   }, ucfirst $system{name};
115   
116   if ($system{notification}) {
117     $data .= '&nbsp;' . a {
118       href => "alertlog.cgi?system=$system{name}"}, img {
119       src    => 'alert.png',
120       border => 0,
121       alt    => 'Alert!',
122       title  => 'This system has alerts', 
123     };
124   } # if
125   
126   $data .=  '<br>' .  
127     a {href => 
128       "plot.cgi?type=loadavg&system=$system{name}&scaling=Hour&points=24"
129      }, img {
130        src    => "plotloadavg.cgi?system=$system{name}&tiny=1",
131        border => 0,
132      };
133    
134   $data .= '</strike>'
135     if $system{active} eq 'false';
136     
137   display td {class => 'dataCentered'}, "$data ",
138     font {class => 'dim' }, "<br>Up: $load{uptime}";
139 } # foreach
140
141 while ($i % $perRow != 0) {
142    $i++;
143    display td {class => 'data'}, '&nbsp;';
144 } # while
145
146 display end_Tr;
147
148 display end_table;
149
150 footing;
151
152 =pod
153
154 =head1 CONFIGURATION AND ENVIRONMENT
155
156 DEBUG: If set then $debug is set to this level.
157
158 VERBOSE: If set then $verbose is set to this level.
159
160 TRACE: If set then $trace is set to this level.
161
162 =head1 DEPENDENCIES
163
164 =head2 Perl Modules
165
166 L<CGI|CGI.html>
167
168 L<CGI::Carp|CGI::Carp>
169
170 L<FindBin>
171
172 L<Getopt::Long|Getopt::Long>
173
174 =head2 ClearSCM Perl Modules
175
176 =begin man 
177
178  Clearadm
179  ClearadmWeb
180  Display
181  Utils
182
183 =end man
184
185 =begin html
186
187 <blockquote>
188 <a href="http://clearscm.com/php/scm_man.php?file=clearadm/lib/Clearadm.pm">Clearadm</a><br>
189 <a href="http://clearscm.com/php/scm_man.php?file=clearadm/lib/ClearadmWeb.pm">ClearadmWeb</a><br>
190 <a href="http://clearscm.com/php/scm_man.php?file=lib/Display.pm">Display</a><br>
191 <a href="http://clearscm.com/php/scm_man.php?file=lib/Utils.pm">Utils</a><br>
192 </blockquote>
193
194 =end html
195
196 =head1 BUGS AND LIMITATIONS
197
198 There are no known bugs in this script
199
200 Please report problems to Andrew DeFaria <Andrew@ClearSCM.com>.
201
202 =head1 LICENSE AND COPYRIGHT
203
204 Copyright (c) 2010, ClearSCM, Inc. All rights reserved.
205
206 =cut