X-Git-Url: https://defaria.com/gitweb/?a=blobdiff_plain;ds=sidebyside;f=clearadm%2Findex.cgi;h=df9a74ad81a6f1a392fa7ca154e96d4f3eac2d0b;hb=901870f2fc61575bff838a8556a9fec652ec7d0b;hp=a5259ea8f09aacb8c793fddb51c424a20104ce7c;hpb=81cbd130706633b1c19ff59371c2ef61d80c562b;p=clearscm.git
diff --git a/clearadm/index.cgi b/clearadm/index.cgi
index a5259ea..df9a74a 100755
--- a/clearadm/index.cgi
+++ b/clearadm/index.cgi
@@ -1,4 +1,4 @@
-#!/usr/bin/perl
+#!/usr/local/bin/perl
=pod
@@ -42,22 +42,23 @@ use warnings;
use FindBin;
use Getopt::Long;
-use CGI qw (:standard *table start_Tr end_Tr);
+use CGI qw(:standard *table start_Tr end_Tr);
use CGI::Carp 'fatalsToBrowser';
+use Convert::Base64;
use lib "$FindBin::Bin/lib", "$FindBin::Bin/../lib";
use ClearadmWeb;
use Clearadm;
-#use Clearcase;
-#use Clearcase::Views;
+use Clearcase;
+use Clearcase::Views;
use Display;
use Utils;
my $clearadm = Clearadm->new;
# Main
-GetOptions (
+GetOptions(
'usage' => sub { Usage },
'verbose' => sub { set_verbose },
'debug' => sub { set_debug },
@@ -94,7 +95,7 @@ my @systems = $clearadm->FindSystem;
$perRow = @systems if @systems < $perRow;
-foreach (@systems) {
+for (@systems) {
my %system = %{$_};
if ($i++ % $perRow == 0) {
@@ -106,8 +107,7 @@ foreach (@systems) {
my $data;
- $data = ''
- if $system{active} eq 'false';
+ $data = '' if $system{active} eq 'false';
$data .= a {
href => "systemdetails.cgi?system=$system{name}"
@@ -115,7 +115,7 @@ foreach (@systems) {
if ($system{notification}) {
$data .= ' ' . a {
- href => "alertlog.cgi?system=$system{name}"}, img {
+ href => "alertlog.cgi?system=$system{name}"}, img {
src => 'alert.png',
border => 0,
alt => 'Alert!',
@@ -123,20 +123,25 @@ foreach (@systems) {
};
} # if
+ my $image = $system{loadavgsmall}
+ ? "data:image/png;base64,$system{loadavgsmall}"
+ : "plotloadavg.cgi?system=$system{name}&tiny=1";
+
$data .= '
' .
a {href =>
"plot.cgi?type=loadavg&system=$system{name}&scaling=Hour&points=24"
}, img {
- src => "plotloadavg.cgi?system=$system{name}&tiny=1",
+ src => $image,
border => 0,
};
- $data .= ''
- if $system{active} eq 'false';
+ $data .= '' if $system{active} eq 'false';
+ $load{uptime} ||= 'Unknown';
+
display td {class => 'dataCentered'}, "$data ",
font {class => 'dim' }, "
Up: $load{uptime}";
-} # foreach
+} # for
while ($i % $perRow != 0) {
$i++;
@@ -203,4 +208,4 @@ Please report problems to Andrew DeFaria .
Copyright (c) 2010, ClearSCM, Inc. All rights reserved.
-=cut
\ No newline at end of file
+=cut