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: mbmon:
Switched to use new filesystems command. Switched to use new filesystems command.
On screen 2 added disk status. 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: mbtask:
Added communication commands for disk watch thread. Added communication commands for disk watch thread.

View File

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

View File

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

View File

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