Update disk watch for FreeBSD

This commit is contained in:
Michiel Broek 2004-03-20 21:30:11 +00:00
parent b994bf4782
commit f2a5b62745
4 changed files with 13 additions and 8 deletions

View File

@ -96,6 +96,9 @@ v0.51.2 06-Mar-2004
mbmon:
Switched to use new filesystems command.
On screen 2 added disk status.
On screen 3, the warning colors for diskspace are now triggered
by the global config setting, red for the upper limit, and
yellow for the upper limit * 4.
mbtask:
Added communication commands for disk watch thread.

View File

@ -485,7 +485,6 @@ int enoughspace(unsigned long needed)
rc = atoi(res);
}
Syslog('s', "enoughspace() rc=%d", rc);
return rc;
}

View File

@ -330,7 +330,7 @@ void disk_stat(void)
{
int ch, i;
char buf[1024], *cnt, *type, *fs, *p, sign;
unsigned long last[10], size, used, perc;
unsigned long last[10], size, used, perc, avail;
clr_index();
set_color(WHITE, BLACK);
@ -356,8 +356,8 @@ void disk_stat(void)
for (i = 0; i < atoi(cnt); i++) {
p = strtok(NULL, " ");
size = atoi(p);
p = strtok(NULL, " ");
used = size - atoi(p);
avail = atoi(strtok(NULL, " "));
used = size - avail;
perc = (used * 100) / size;
sign = ' ';
fs = strtok(NULL, " ");
@ -373,12 +373,15 @@ void disk_stat(void)
mvprintw(i+8, 1, "%8lu %8lu ", size, used);
set_color(WHITE, BLACK);
printf("%c ", sign);
set_color(CYAN, BLACK);
if (strstr(type, "iso") == NULL) {
if (perc >= 95)
if (avail <= CFG.freespace)
set_color(LIGHTRED, BLACK);
else if (perc >= 80)
else if (avail <= (CFG.freespace * 4))
set_color(YELLOW, BLACK);
else
set_color(CYAN, BLACK);
} else {
set_color(CYAN, BLACK);
}
printf("%3lu", perc);
putchar('%');

View File

@ -305,7 +305,7 @@ void add_path(char *path)
}
}
Syslog('d', "Should be on \"%s\" \"%s\"", fsname, fstype);
fill_mfslist(&mfs, fsname);
fill_mfslist(&mfs, fsname, fstype);
free(fsname);
free(fstype);
}