diff options
Diffstat (limited to 'src/status.c')
-rw-r--r-- | src/status.c | 57 |
1 files changed, 30 insertions, 27 deletions
diff --git a/src/status.c b/src/status.c index 8cbf523..f7148f9 100644 --- a/src/status.c +++ b/src/status.c @@ -20,27 +20,29 @@ int status_init(struct status* s) { int status = 0; - s->memmax = 0; - s->memavg = 0; - s->loadavg = 0; - s->loadmax = 0; - s->nettx = 0; - s->netrx = 0; - s->count = 0; - s->uptime = 0; + s->memtotal = 0; + s->memusedmax = 0; + s->memusedavg = 0; + s->loadavg = 0; + s->loadmax = 0; + s->nettx = 0; + s->netrx = 0; + s->count = 0; + s->uptime = 0; FILE* fd = fopen("/tmp/cmon.status", "r"); if(fd) { - status += fscanf(fd, "memmax:%ld\n", &s->memmax); - status += fscanf(fd, "memavg:%ld\n", &s->memavg); - status += fscanf(fd, "loadmax:%lf\n", &s->loadmax); - status += fscanf(fd, "loadavg:%lf\n", &s->loadavg); - status += fscanf(fd, "nprocs:%d\n", &s->nprocs); - status += fscanf(fd, "nettx:%lld\n", &s->nettx); - status += fscanf(fd, "netrx:%lld\n", &s->netrx); - status += fscanf(fd, "uptime:%ld\n", &s->uptime); - status += fscanf(fd, "count:%ld\n", &s->count); - if(status != 9) { + status += fscanf(fd, "memtotal:%ld\n", &s->memtotal); + status += fscanf(fd, "memusedmax:%ld\n", &s->memusedmax); + status += fscanf(fd, "memusedavg:%ld\n", &s->memusedavg); + status += fscanf(fd, "loadmax:%lf\n", &s->loadmax); + status += fscanf(fd, "loadavg:%lf\n", &s->loadavg); + status += fscanf(fd, "nprocs:%d\n", &s->nprocs); + status += fscanf(fd, "nettx:%lld\n", &s->nettx); + status += fscanf(fd, "netrx:%lld\n", &s->netrx); + status += fscanf(fd, "uptime:%ld\n", &s->uptime); + status += fscanf(fd, "count:%ld\n", &s->count); + if(status != 10) { fprintf(stderr, "ERROR reading status file\n"); return 0; } @@ -52,15 +54,16 @@ int status_init(struct status* s) { int status_write(struct status* s) { FILE* fd = fopen("/tmp/cmon.status", "w"); - fprintf(fd, "memmax:%ld\n", s->memmax); - fprintf(fd, "memavg:%ld\n", s->memavg); - fprintf(fd, "loadmax:%lf\n", s->loadmax); - fprintf(fd, "loadavg:%lf\n", s->loadavg); - fprintf(fd, "nprocs:%d\n", s->nprocs); - fprintf(fd, "nettx:%lld\n", s->nettx); - fprintf(fd, "netrx:%lld\n", s->netrx); - fprintf(fd, "uptime:%ld\n", s->uptime); - fprintf(fd, "count:%ld\n", s->count); + fprintf(fd, "memtotal:%ld\n", s->memtotal); + fprintf(fd, "memusedmax:%ld\n", s->memusedmax); + fprintf(fd, "memusedavg:%ld\n", s->memusedavg); + fprintf(fd, "loadmax:%lf\n", s->loadmax); + fprintf(fd, "loadavg:%lf\n", s->loadavg); + fprintf(fd, "nprocs:%d\n", s->nprocs); + fprintf(fd, "nettx:%lld\n", s->nettx); + fprintf(fd, "netrx:%lld\n", s->netrx); + fprintf(fd, "uptime:%ld\n", s->uptime); + fprintf(fd, "count:%ld\n", s->count); fclose(fd); return 1; |