[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Changes to monit/validate.c
From: |
Martin Pala |
Subject: |
Changes to monit/validate.c |
Date: |
Thu, 09 Dec 2004 13:10:55 -0500 |
Index: monit/validate.c
diff -u monit/validate.c:1.126 monit/validate.c:1.127
--- monit/validate.c:1.126 Wed Dec 8 12:27:20 2004
+++ monit/validate.c Thu Dec 9 17:02:44 2004
@@ -90,7 +90,7 @@
* @author Martin Pala <address@hidden>
* @author Christian Hopp <address@hidden>
*
- * @version \$Id: validate.c,v 1.126 2004/12/08 12:27:20 martinp Exp $
+ * @version \$Id: validate.c,v 1.127 2004/12/09 17:02:44 martinp Exp $
* @file
*/
@@ -239,6 +239,14 @@
"'%s' unable to read device %s state", s->name, s->path);
return FALSE;
} else {
+ s->inf->inode_percent=
+ (int)((float)(1000 * (s->inf->f_files - s->inf->f_filesfree)) /
+ (float)s->inf->f_files);
+ s->inf->space_percent=
+ (int)((float)(1000 * (s->inf->f_blocks - s->inf->f_blocksfree)) /
+ (float)s->inf->f_blocks);
+ s->inf->inode_total= s->inf->f_files - s->inf->f_filesfree;
+ s->inf->space_total= s->inf->f_blocks - s->inf->f_blocksfreetotal;
Event_post(s, EVENT_DATA, FALSE, s->action_DATA,
"'%s' succeeded getting device statistic for %s", s->name, s->path);
}
@@ -906,69 +914,57 @@
}
if(td->limit_percent >= 0) {
- int value =
- (int)((float)(100 * (s->inf->f_files - s->inf->f_filesfree)) /
- (float)s->inf->f_files);
- if(compare_value( td->operator, value, td->limit_percent)) {
+ if(compare_value( td->operator, s->inf->inode_percent,
td->limit_percent)) {
Event_post(s, EVENT_RESOURCE, TRUE, td->action,
"'%s' inode usage %ld%% matches resource limit [inode
usage%s%d%%]",
s->name,
- value,
+ s->inf->inode_percent/10.,
operatorshortnames[td->operator],
- td->limit_percent);
+ td->limit_percent/10.);
return;
}
} else {
- int value = s->inf->f_files - s->inf->f_filesfree;
- if(compare_value(td->operator, value, td->limit_absolute)) {
+ if(compare_value(td->operator, s->inf->inode_total,
td->limit_absolute)) {
Event_post(s, EVENT_RESOURCE, TRUE, td->action,
"'%s' inode usage %ld matches resource limit [inode usage%s%ld]",
s->name,
- value,
+ s->inf->inode_total,
operatorshortnames[td->operator],
td->limit_absolute);
return;
}
}
DEBUG("'%s' inode usage check passed [current inode usage=%.1f%%]\n",
- s->name,
- (float)(100 * (s->inf->f_files - s->inf->f_filesfree)) /
- (float)s->inf->f_files);
+ s->name, s->inf->inode_percent/10.);
Event_post(s, EVENT_RESOURCE, FALSE, td->action,
"'%s' device resources passed", s->name);
return;
case RESOURCE_ID_SPACE:
if(td->limit_percent >= 0) {
- int value =
- (int)((float)(100 * (s->inf->f_blocks - s->inf->f_blocksfreetotal)) /
- (float)s->inf->f_blocks);
- if(compare_value( td->operator, value, td->limit_percent)) {
+ if(compare_value( td->operator, s->inf->space_percent,
td->limit_percent)) {
Event_post(s, EVENT_RESOURCE, TRUE, td->action,
"'%s' space usage %ld%% matches resource limit [space usage%s%d%%]",
s->name,
- value,
+ s->inf->space_percent/10.,
operatorshortnames[td->operator],
- td->limit_percent);
+ td->limit_percent/10.);
return;
}
} else {
- int value = s->inf->f_blocks - s->inf->f_blocksfreetotal;
- if(compare_value(td->operator, value, td->limit_absolute)) {
+ if(compare_value(td->operator, s->inf->space_total,
td->limit_absolute)) {
Event_post(s, EVENT_RESOURCE, TRUE, td->action,
"'%s' space usage %ld blocks matches resource limit "
"[space usage%s%ld blocks]",
s->name,
- value,
+ s->inf->space_total,
operatorshortnames[td->operator],
td->limit_absolute);
return;
}
}
DEBUG("'%s' space usage check passed [current space usage=%.1f%%]\n",
- s->name,
- (float)(100 * (s->inf->f_blocks - s->inf->f_blocksfreetotal)) /
- (float)s->inf->f_blocks);
+ s->name, s->inf->space_percent/10.);
Event_post(s, EVENT_RESOURCE, FALSE, td->action,
"'%s' device resources passed", s->name);
return;
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- Changes to monit/validate.c,
Martin Pala <=