monit-dev
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Changes to monit/http/cervlet.c


From: Martin Pala
Subject: Changes to monit/http/cervlet.c
Date: Thu, 09 Dec 2004 12:13:27 -0500

Index: monit/http/cervlet.c
diff -u monit/http/cervlet.c:1.166 monit/http/cervlet.c:1.167
--- monit/http/cervlet.c:1.166  Wed Dec  8 15:22:41 2004
+++ monit/http/cervlet.c        Thu Dec  9 17:02:46 2004
@@ -143,7 +143,7 @@
  *  @author Martin Pala <address@hidden>
  *  @author Christian Hopp <address@hidden>
  *
- *  @version \$Id: cervlet.c,v 1.166 2004/12/08 15:22:41 martinp Exp $
+ *  @version \$Id: cervlet.c,v 1.167 2004/12/09 17:02:46 martinp Exp $
  *
  *  @file
  */
@@ -964,18 +964,15 @@
       
       out_print(res,
        "<td align=\"right\">%.1f%% [%.1f&nbsp;MB]</td>",
-       (float)100 * (float)(s->inf->f_blocks - s->inf->f_blocksfree) /
-        (float)s->inf->f_blocks,
-       (float)(s->inf->f_blocks - s->inf->f_blocksfree) / (float)1048576 *
-        (float)s->inf->f_bsize);
+        s->inf->space_percent/10.,
+       (float)s->inf->space_total / (float)1048576 * (float)s->inf->f_bsize);
 
       if(s->inf->f_files > 0) {
 
         out_print(res,
          "<td align=\"right\">%.1f%% [%ld&nbsp;objects]</td>",
-         (float)100 * (float)(s->inf->f_files - s->inf->f_filesfree) /
-          (float)s->inf->f_files,
-         s->inf->f_files - s->inf->f_filesfree);
+          s->inf->inode_percent/10.,
+         s->inf->inode_total);
 
       } else {
 
@@ -1466,23 +1463,39 @@
        
       if(dl->resource == RESOURCE_ID_INODE) {
          
-        out_print(res,
-         "<tr><td>Inodes usage limit</td><td>If %s %ld %s "
-         "then %s else if recovered then %s</td></tr>",
-         operatornames[dl->operator],
-         (dl->limit_absolute > -1)?dl->limit_absolute:dl->limit_percent,
-         (dl->limit_absolute > -1)?"":"%",
-         actionnames[a->failed->id], actionnames[a->passed->id]);
+        if(dl->limit_absolute > -1) {
+          out_print(res,
+           "<tr><td>Inodes usage limit</td><td>If %s %ld "
+           "then %s else if recovered then %s</td></tr>",
+           operatornames[dl->operator],
+           dl->limit_absolute,
+           actionnames[a->failed->id], actionnames[a->passed->id]);
+        } else {
+          out_print(res,
+           "<tr><td>Inodes usage limit</td><td>If %s %.1f%% "
+           "then %s else if recovered then %s</td></tr>",
+           operatornames[dl->operator],
+           dl->limit_percent/10.,
+           actionnames[a->failed->id], actionnames[a->passed->id]);
+        }
          
       } else if(dl->resource == RESOURCE_ID_SPACE) {
          
-        out_print(res,
-         "<tr><td>Space usage limit</td><td>If %s %ld %s "
-         "then %s else if recovered then %s</td></tr>",
-          operatornames[dl->operator],
-         (dl->limit_absolute > -1)?dl->limit_absolute:dl->limit_percent,
-         (dl->limit_absolute > -1)?"blocks":"%",
-         actionnames[a->failed->id], actionnames[a->passed->id]);
+        if(dl->limit_absolute > -1) {
+          out_print(res,
+           "<tr><td>Space usage limit</td><td>If %s %ld blocks "
+           "then %s else if recovered then %s</td></tr>",
+            operatornames[dl->operator],
+           dl->limit_absolute,
+           actionnames[a->failed->id], actionnames[a->passed->id]);
+        } else {
+          out_print(res,
+           "<tr><td>Space usage limit</td><td>If %s %.1f%% "
+           "then %s else if recovered then %s</td></tr>",
+            operatornames[dl->operator],
+           dl->limit_percent/10.,
+           actionnames[a->failed->id], actionnames[a->passed->id]);
+        }
       }
     }
   }




reply via email to

[Prev in Thread] Current Thread [Next in Thread]