Index: /trunk/tools/czarplot.pl
===================================================================
--- /trunk/tools/czarplot.pl	(revision 28861)
+++ /trunk/tools/czarplot.pl	(revision 28862)
@@ -87,4 +87,4 @@
 if ($histogram) {$czarplot->createHistogram($label, $begin, $end);}
 if ($nebulous) {$czarplot->plotDiskUsageHistogram();}
-if ($nebulous) {$czarplot->plotStorageTimeSeries($begin, $end);}
+#if ($nebulous) {$czarplot->plotStorageTimeSeries($begin, $end);}
 
Index: /trunk/tools/czartool/CzarDb.pm
===================================================================
--- /trunk/tools/czartool/CzarDb.pm	(revision 28861)
+++ /trunk/tools/czartool/CzarDb.pm	(revision 28862)
@@ -159,5 +159,5 @@
 ###########################################################################
 sub updateHost {
-    my ($self, $host, $total, $available, $used) = @_;
+    my ($self, $host, $total, $available, $used, $readable, $writable) = @_;
 
     my $query = $self->{_db}->prepare(<<SQL);
@@ -168,7 +168,7 @@
     $query = $self->{_db}->prepare(<<SQL);
     INSERT INTO hosts
-        (host, total, available, used)
+        (host, total, available, used, readable, writable)
         VALUES
-        ('$host', $total, $available, $used);
+        ('$host', $total, $available, $used, $readable, $writable);
 SQL
     $query->execute;
@@ -352,12 +352,12 @@
 ###########################################################################
 sub createHostsData {
-    my ($self) = @_;
-
-    my $dataFile = "/tmp/czarplot_hosts.dat";
+    my ($self, $limit) = @_;
+
+    my $dataFile = "/tmp/czarplot_hosts_space.dat";
     open (GNUDAT, ">$dataFile");
 
     my $query = $self->{_db}->prepare(<<SQL);
     SELECT 
-        host, used, available 
+        host, used, available, writable, readable 
         FROM hosts
         ORDER BY host;
@@ -366,13 +366,62 @@
     $query->execute;
 
+    my $underLimit;
+    my $hostOut;
+
     # loop round results
     while (my @row = $query->fetchrow_array()) {
 
-        my ($host, $used, $available) = @row;
-        print GNUDAT "$host $used $available\n";
+        my ($host, $used, $available, $writable, $readable) = @row;
+   
+        if (($used/($used+$available))*100 > $limit) {$underLimit = 0;}
+        else {$underLimit = 1;}
+
+        if ($host =~ m/ipp0([0-9]+)/) {$hostOut = $1;}
+
+        # Col 1: host
+        print GNUDAT "$hostOut";
+        
+        # Col 2: available, readable used space under limit
+        if ($readable && $underLimit) {print GNUDAT " $used";}
+        else {print GNUDAT " 0";}
+
+        # Col 3: available, readable used space OVER limit
+        if ($readable && !$underLimit) {print GNUDAT " $used";}
+        else {print GNUDAT " 0";}
+
+        # Col 4: NOT available used space
+        if (!$readable) {print GNUDAT " $used";}
+        else {print GNUDAT " 0";}
+
+        # Col 5: available writable space
+        if($writable) {print GNUDAT " $available";}
+        else {print GNUDAT " 0";}
+
+        # Col 6: NOT available writable space
+        if(!$writable) {print GNUDAT " $available";}
+        else {print GNUDAT " 0";}
+
+        print GNUDAT "\n";
     }
     close(GNUDAT);
 
     return $dataFile;
+}
+
+###########################################################################
+#
+# Gets total used cluster space as a percentage
+#
+############################################################################
+sub getTotalClusterStorageAsPercentage {
+    my ($self) = @_;
+
+    my $query = $self->{_db}->prepare(<<SQL);
+    SELECT used/total*100 
+        FROM cluster_space 
+        ORDER BY timestamp DESC LIMIT 1;
+SQL
+    $query->execute;
+    return scalar $query->fetchrow_array();
 }
 
@@ -454,5 +503,5 @@
 
     my $currentRevision = -1;
-    my $latestRevision = 9;
+    my $latestRevision = 10;
 
     while ($currentRevision != $latestRevision) {
@@ -470,5 +519,42 @@
         elsif ($currentRevision == 7) {$self->createRevision_8();}
         elsif ($currentRevision == 8) {$self->createRevision_9();}
-    }
+        elsif ($currentRevision == 9) {$self->createRevision_10();}
+    }
+}
+
+#######################################################################################
+# 
+# Sets current revision of ippToPsps database
+#
+#######################################################################################
+sub setRevision {
+    my ($self, $revision) = @_;
+
+    my $query = $self->{_db}->prepare(<<SQL);
+    INSERT INTO revision (revision) VALUES ($revision);
+SQL
+    $query->execute;
+}
+
+#######################################################################################
+# 
+# Gets current revision of ippToPsps database
+#
+#######################################################################################
+sub getRevision {
+    my ($self) = @_;
+
+    if (!$self->SUPER::doesTableExist("revision")) {return 0;}
+
+    my $query = $self->{_db}->prepare(<<SQL);
+    SELECT revision
+        FROM revision
+        ORDER BY revision DESC LIMIT 1;
+SQL
+
+    $query->execute;
+    my @row = $query->fetchrow_array();
+
+    return $row[0];
 }
 
@@ -739,36 +825,21 @@
 #######################################################################################
 # 
-# Sets current revision of ippToPsps database
-#
-#######################################################################################
-sub setRevision {
-    my ($self, $revision) = @_;
-
-    my $query = $self->{_db}->prepare(<<SQL);
-    INSERT INTO revision (revision) VALUES ($revision);
-SQL
-    $query->execute;
-}
-
-#######################################################################################
-# 
-# Gets current revision of ippToPsps database
-#
-#######################################################################################
-sub getRevision {
-    my ($self) = @_;
-
-    if (!$self->SUPER::doesTableExist("revision")) {return 0;}
-
-    my $query = $self->{_db}->prepare(<<SQL);
-    SELECT revision
-        FROM revision
-        ORDER BY revision DESC LIMIT 1;
-SQL
-
-    $query->execute;
-    my @row = $query->fetchrow_array();
-
-    return $row[0];
+# Create revision 10 of the database 
+#
+#######################################################################################
+sub createRevision_10 {
+    my ($self) = @_;
+
+    print "* Creating revision 10 of '$self->{_dbName}'\n";
+
+    my $query = $self->{_db}->prepare(<<SQL);
+    ALTER TABLE hosts 
+        ADD COLUMN writable TINYINT NOT NULL DEFAULT 0,
+        ADD COLUMN readable TINYINT NOT NULL DEFAULT 0;
+SQL
+
+    $query->execute;
+
+    $self->setRevision(10);
 }
 
Index: /trunk/tools/czartool/Czarplot.pm
===================================================================
--- /trunk/tools/czartool/Czarplot.pm	(revision 28861)
+++ /trunk/tools/czartool/Czarplot.pm	(revision 28862)
@@ -347,7 +347,11 @@
     my ($self) = @_;
 
-    my $outputFile = "/tmp/czarplot_hosts.png";
-
-    my $inputFile = $self->{_czarDb}->createHostsData();
+    my $outputFile = "/tmp/czarplot_hosts_space.png";
+    my $limit = 97.0;
+    my $inputFile = $self->{_czarDb}->createHostsData($limit);
+
+    my $totalUsed = $self->{_czarDb}->getTotalClusterStorageAsPercentage();
+
+my $totalPercent = sprintf("%.1f%%", $totalUsed);
 
     open (GP, "|/usr/bin/gnuplot -persist") or die "no gnuplot";
@@ -358,5 +362,5 @@
         "set term $self->{_outputFormat};" .
         "set output \"$outputFile\";" .
-        "set title \"Nebulous disk use across IPP cluster\";" .
+        "set title \"Nebulous disk use across IPP cluster ($totalPercent of total allocated)\";" .
         "set style fill solid 1.00 border -1;" .
         "set style histogram rowstacked;" .
@@ -364,5 +368,11 @@
         "set ylabel \"Space (TB)\";" .
         "set xtic rotate by -90 scale 0;" .
-        "plot '$inputFile' using 2:xtic(1) t \"Used\" , '' using 3 t \"Available\";" .
+        "plot '$inputFile' " .
+        "using 2:xtic(1) t \"Used\" lt 7," .
+        "'' using 3 t \"Over $limit% used\" lt 1," . 
+        "'' using 4 t \"Unavailable\" fs solid 0.50 lt -1 ," . 
+        "'' using 5 t \"Free\" lt 2," . 
+        "'' using 6 notitle fs solid 0.50 lt -1" . 
+        ";" .
 
         "\n";
Index: /trunk/tools/czartool/Nebulous.pm
===================================================================
--- /trunk/tools/czartool/Nebulous.pm	(revision 28861)
+++ /trunk/tools/czartool/Nebulous.pm	(revision 28862)
@@ -93,4 +93,6 @@
     $self->{_totalHosts} = 0;
     $self->{_hostsOverNinetyEightPC} = 0;
+    my $readable;
+    my $writable;
     foreach $line (@cmdOut) {
 
@@ -113,6 +115,11 @@
             if ($4 >= 98) {$self->{_hostsOverNinetyEightPC}++;}
 
-#            print $1 . " " . $self->convertKbToTb($2+$3) . " " . $self->convertKbToTb($2) . " " . $self->convertKbToTb($3) . " $4PC \n" ; 
-            $self->{_czarDb}->updateHost($1, $self->convertKbToTb($2+$3), $self->convertKbToTb($3), $self->convertKbToTb($2));
+            $self->getReadableWritableStatus($1, \$readable, \$writable);
+
+            $self->{_czarDb}->updateHost($1, 
+                    $self->convertKbToTb($2+$3), 
+                    $self->convertKbToTb($3), 
+                    $self->convertKbToTb($2), 
+                    $readable, $writable);
         }
     }
@@ -123,5 +130,32 @@
             $self->{_totalUsed}, 
             $self->{_hostsOverNinetyEightPC});
+}
 
+###########################################################################
+#
+# Runs neb-host and readable/writable status for this host 
+#
+###########################################################################
+sub getReadableWritableStatus {
+    my ($self, $host, $readable, $writable) = @_;
+
+    ${$readable} = 0;
+    ${$writable} = 0;
+
+    my @cmdOut = `neb-host`;
+    my $line;
+    foreach $line (@cmdOut) {
+
+        chomp($line);
+        if ($line =~ m/$host\s+[0-9.A-Za-z]+\s+([01]+)\s+([01]+)\s+([01]+)\s+.*/i) {
+
+            # if mounted...
+            if ($1) {
+
+                ${$readable} = $3;
+                ${$writable} = $2;
+            }
+        }
+    }
 }
 1;
Index: /trunk/tools/roboczar.pl
===================================================================
--- /trunk/tools/roboczar.pl	(revision 28861)
+++ /trunk/tools/roboczar.pl	(revision 28862)
@@ -106,5 +106,5 @@
         print "* Checking Nebulous\n";
         $nebulous->updateClusterSpaceInfo();
-
+        $czarplot->plotDiskUsageHistogram();
         updateServerStatus();
         updateLabels();
